Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-invite

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-invite

a powerfull discord inviter tracker

  • 4.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-1.04%
Maintainers
1
Weekly downloads
 
Created
Source

Discord

discord-invite

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

Support

📂 NPM

📝 Github

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.id) {
  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.id) {
 console.log(`${member.user.tag} Lefted Server Using Vanity URL!`);
} else {
 invClient.inviteRemove(member.guild.id, inviter,1);
 console.log(`${member.user.tag} Lefted the server! inviter ${inviter.tag}`);
};
});


client.login("your secret bot token 👻")

discord-invite Also Supports TypeScript And EsModule 🥳!

Credits

Made by FiveSoBes, Relivent And Luppux Development

Contact & Support & Donate

Buy Me A Coffee

Discord Banner

Keywords

FAQs

Package last updated on 18 Aug 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc