Use this command in your terminal to install the package.
cd project-path
npm i --save more-djs-events
Check your intents, some events won't be emitted if the required intents are missing!
const Discord = require("discord.js");
const moreDJSEvents = require("more-djs-events").default;
const intents = [
"GUILDS",
"GUILD_MEMBERS",
"GUILD_BANS",
"GUILD_EMOJIS_AND_STICKERS",
"GUILD_INTEGRATIONS",
"GUILD_WEBHOOKS",
"GUILD_INVITES",
"GUILD_VOICE_STATES",
"GUILD_PRESENCES",
"GUILD_MESSAGES",
"GUILD_MESSAGE_REACTIONS",
"GUILD_MESSAGE_TYPING",
"DIRECT_MESSAGES",
"DIRECT_MESSAGE_REACTIONS",
"DIRECT_MESSAGE_TYPING",
];
const partials = ["USER", "CHANNEL", "GUILD_MEMBER", "MESSAGE", "REACTION"];
const client = new Discord.Client({
intents,
partials,
});
(async () => {
await moreDJSEvents(client);
await client.login("token");
})();
//Example Events:
client.on("guildMemberVoiceConnect", (member, channel) => {});
client.on("guildMemberVoiceDisconnect", (member, oldChannel) => {});
client.on("guildMemberVoiceSwitch", (member, oldChannel, newChannel) => {});
Here are the current events with their types.
interface ClientEvents {
guildMemberVoiceDisconnect: [
member: GuildMember,
oldVoiceChannel: VoiceChannel | StageChannel
];
guildMemberVoiceConnect: [
member: GuildMember,
voiceChannel: VoiceChannel | StageChannel
];
guildMemberVoiceSwitch: [
member: GuildMember,
oldVoiceChannel: VoiceChannel | StageChannel,
newVoiceChannel: VoiceChannel | StageChannel
];
guildMemberUsernameChange: [
member: GuildMember,
oldUsername: string,
newUsername: string
];
guildMemberDiscrminatorChange: [
member: GuildMember,
oldUsername: string,
newUsername: string
];
guildMemberAvatarChange: [
member: GuildMember,
oldAvatarURL: string | null,
newAvatarURL: string | null
];
guildMemberAvatarUserChange: [
member: GuildMember,
oldAvatarURL: string | null,
newAvatarURL: string | null
];
guildMemberBannerChange: [
member: GuildMember,
oldAvatarURL: string | null,
newAvatarURL: string | null
];
guildMemberUserDelete: [member: GuildMember];
guildMemberHexColorChange: [
member: GuildMember,
oldHexColor: `#${string}`,
newHexColor: `#${string}`
];
guildMemberDisplayNameChange: [
member: GuildMember,
oldNickname: string,
newNickname: string
];
guildMemberNicknameChange: [
member: GuildMember,
oldNickname: string | null,
newNickname: string | null
];
guildMemberPartialChange: [
member: GuildMember,
oldPartial: boolean,
newPartial: boolean
];
guildMemberPendingChange: [
member: GuildMember,
oldPending: boolean,
newPending: boolean
];
guildMemberPermissionsChange: [
member: GuildMember,
oldPermissions: Readonly<Permissions>,
newPermissions: Readonly<Permissions>
];
guildMemberSubscribedToNitro: [member: GuildMember];
guildMemberUnsubscribedToNitro: [member: GuildMember];
guildMemberPresenceChange: [
member: GuildMember,
oldPresense: Presence | null,
newPresense: Presence | null
];
guildAFKChannelChange: [
oldChannel: VoiceChannel | null,
newChannel: VoiceChannel | null
];
guildAFKTimeoutChange: [
guild: Guild,
oldTimeout: number,
newTimeout: number
];
guildBannerChange: [
guild: Guild,
oldBanner: string | null,
newBanner: string | null
];
guildMemberRoleAdd: [member: GuildMember, role: Role];
guildMemberRoleRemove: [member: GuildMember, role: Role];
guildChannelPermissionsUpdate: [
channel: GuildChannel,
oldPermissions: Collection<
string,
{
allow: PermissionString[];
deny: PermissionString[];
}
>,
newPermissions: Collection<
string,
{
allow: PermissionString[];
deny: PermissionString[];
}
>
];
guildChannelNameChange: [
channel: GuildChannel,
oldChannelName: string,
newChanelName: string
];
guildChannelParentChange: [
channel: GuildChannel,
oldParent: CategoryChannel | null,
newParent: CategoryChannel | null
];
guildChannelPositionChange: [
channel: GuildChannel,
oldChannelPosition: number,
newChanelPosition: number
];
}
We're just setting the bases of this package for now, We'll add a lot events soon.
You can join our discord server to give us suggestions or reports Discord Server.
You can find the source code on Github.