Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bes-js/discord-invite

a powerfull discord inviter tracker
https://github.com/bes-js/discord-invite

discord discord-bot discord-bots discord-invite discord-invite-bot discord-invite-manager discord-js discord-v12 discord-v13 discord-v13-bot discord-v14 discord-v14-bot

Last synced: about 2 months ago
JSON representation

a powerfull discord inviter tracker

Awesome Lists containing this project

README

        



Discord

# [discord-invite](https://discord.gg/luppux)

> **Track the invites in your servers to know who invited who and with which invite!**

#
### ❔ [Support](https://discord.gg/luppux)
### 📂 [NPM](https://npmjs.com/discord-invite)
### 📝 [Github](https://github.com/Bes-js/discord-invite)

#
# Installation

```bash
npm i discord-invite
```
#
# Quick Example

**Example For CommonJS**
```js
/* Importing The Package */
const InviteManager = require('discord-invite');
const invClient = new InviteManager(client); // client = Discord.Client();

```
#
**Events**
```js
/* Guild Member Join Event */
client.on("memberJoin",async(member,inviter,invite) => { });

/* Guild Member Leave Event */
client.on("memberLeave",async(member,inviter,invite) => { });
```
#
**Functions**
```js
const InviteManager = require('discord-invite');
const { Client } = require("discord.js");
const invClient = new InviteManager(client);

invClient.inviteAdd(guildId, user); /* */
invClient.inviteRemove(guildId, user); /* */
invClient.getMemberInvites(guildId, user); /* */
invClient.getGuildInvites(guildId, limit); /* - limit = min 1 / max 50 / default 10 */
```
#
**Example Usage;**
```js
const InviteManager = require('discord-invite');
const { Client } = require("discord.js");
const invClient = new InviteManager(client); // client = Discord.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);
console.log(`${member.user.tag} Joined the server! inviter ${inviter.username}`);
};
});

/* Leave Event */

client.on("memberLeave",async(member,inviter,invite) => {
if(!inviter) {
console.log(`${member.user.tag} Lefted the server, but I couldn't find out who was invited.`);
} else if(member.id == inviter.id) {
console.log(`${member.user.tag} Lefted the server by his own invitation!`);
} else if(member.guild.vanityURLCode == inviter) {
console.log(`${member.user.tag} Lefted Server Using Vanity URL!`);
} else {
invClient.inviteRemove(member.guild.id, inviter);
console.log(`${member.user.tag} Lefted the server! inviter ${inviter.tag}`);
};
});

client.login("your secret bot token 👻")
```
**[discord-invite](https://discord.gg/luppux) Also Supports TypeScript And EsModule 🥳!**

#
# Credits

**Made by [FiveSoBes](https://github.com/Bes-js), [Relivent](https://github.com/Relivent) And [Luppux Development](https://github.com/Luppux)**

# Contact & Support & Donate
Buy Me A Coffee

[![Discord Banner](https://api.weblutions.com/discord/invite/luppux/)](https://discord.gg/luppux)