Skip to content

SlipBey/invite-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

github supportServer totalDownloads weeklyDownloads version stars license

Invite Modle

Discord.JS v13 invite logger module.

Installation

$ npm install invite-module

Examples

Paramaters:

member -> invited user and returns as server member

invite -> invite code

inviter -> inviter and return as user

guild -> in member guild

Client and Intent:

const { Discord, Client, Collection, Intents, Guild } = require('discord.js');
const client = new Client({ 
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_INVITES] ,
    partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'ROLE', "GUILD_MEMBER", "USER", "GUILD_INVITES", "MANAGE_GUILD"],
    });
//get the module
const invite = require('invite-module');
invite.inviteCounter(client);

guildMemberAdd, memberJoin event now. guildMemberRemove, memberLeave event now.

Use:

client.on("memberJoin", async(member, invite, inviter, guild) => {
    console.log(`${member} joined the server, inviting by: **${inviter.username}**.`);
})

client.on("memberLeave", async(member, invite, inviter, guild) => {
    console.log(`${member.user.tag} left the server, was invited by: **${inviter}**.`);  
})

Or:

client.on("memberJoin", async(member, invite, inviter, guild) => {
    guild.channels.cache.get('channel-id').send(`${member} joined the server, inviting by: **${inviter.username}**.`);
})

client.on("memberLeave", async(member, invite, inviter, guild) => {
    guild.channels.cache.get('channel-id').send(`${member.user.tag} left the server, was invited by: **${inviter}**.`);
})

Use of invitation code and guild:

client.on("memberJoin", async(member, invite, inviter, guild) => {
    console.log(`Joined ${member}, "${guild}" server, using invite code: ${invite}. Invited by: **${inviter.username}**`);
 })

Or

client.on("memberJoin", async(member, invite, inviter, guild) => {
    guild.channels.cache.get('channel-id').send(`Joined ${member}, "${guild}" server, using invite code: ${invite}. Invited by: **${inviter.username}**`);
})

Detailed explanation: https://youtu.be/UGWd9BBD6T4