Socket
Socket
Sign inDemoInstall

discord-invite

Package Overview
Dependencies
13
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    discord-invite

a powerfull discord inviter tracker


Version published
Maintainers
1
Install size
5.18 MB
Created

Readme

Source

Discord

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

Contact & Support & Donate

Buy Me A Coffee

Discord Banner

Keywords

FAQs

Last updated on 09 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc