discord-invite
v4.0.8
Published
a powerfull discord inviter tracker
Downloads
6,556
Maintainers
Readme
discord-invite
Track the invites in your servers to know who invited who and with which invite!
❔ Support
📂 NPM
📝 Github
Click here for an example of a ready-made bot made using TypeScript
.
Installation
npm i discord-invite
Quick Example
Example For CommonJS
/* Importing The Package */
const InviteManager = require('discord-invite');
const invClient = new InviteManager(client); // client = Discord.Client();
Events
/* Guild Member Join Event */
client.on("memberJoin",async(member,inviter,invite) => { });
/* Guild Member Leave Event */
client.on("memberLeave",async(member,inviter,invite) => { });
Functions
const InviteManager = require('discord-invite');
const { Client } = require("discord.js");
const invClient = new InviteManager(client);
invClient.inviteAdd(guildId, user, count); /* <null> */
invClient.inviteRemove(guildId, user, count); /* <null> */
invClient.getMemberInvites(guildId, user); /* <number> */
invClient.getGuildInvites(guildId, limit); /* <Array> */
Example Usage;
const InviteManager = require('discord-invite');
const { Client } = require("discord.js");
const client = new Client();
const invClient = new InviteManager(client);
/* Join Event */
client.on("memberJoin", async function(member, inviter, invite) {
if(!inviter) {
console.log(`${member.user.username} joined the server, but I couldn't find out who was invited.`);
} else if(member.id == inviter.id) {
console.log(`${member.user.username} Joined the server by his own invitation!`);
}else if(member.guild.vanityURLCode == inviter) {
console.log(`${member.user.username} Joined Server Using Vanity URL!`);
} else {
invClient.inviteAdd(member.guild.id, inviter,1);
console.log(`${member.user.username} Joined the server! inviter ${inviter.username}`);
};
});
/* Leave Event */
client.on("memberLeave",async(member,inviter,invite) => {
if(!inviter) {
console.log(`${member.user.username} Lefted the server, but I couldn't find out who was invited.`);
} else if(member.id == inviter.id) {
console.log(`${member.user.username} Lefted the server by his own invitation!`);
} else if(member.guild.vanityURLCode == inviter) {
console.log(`${member.user.username} Lefted Server Using Vanity URL!`);
} else {
invClient.inviteRemove(member.guild.id, inviter,1);
console.log(`${member.user.username} Lefted the server! inviter ${inviter.username}`);
};
});
client.login("your secret bot token 👻")
discord-invite Also Supports TypeScript And EsModule 🥳!
Credits
Made by FiveSoBes And Luppux Development