discord-events.js
v1.0.2
Published
A package that gives more better Discord.js events.
Downloads
17
Maintainers
Readme
📖 About
discord-events.js is a module that gives to your Discord client many events that are much more precise. It is useful for a logs system for example.
💻 Installation
npm install discord-events.js
❔ Help
- For the usage, you can read the Documentation below.
- For more precise help, you can join this server: Click to join, and contact the Developer (me).
📚 Documentation
You can find below the list of all the events that discord-events.js gives to your client and how to use them. Click on the name to expand the events.
Usage Example
const { Client } = require('discord.js');
const events = require('discord-events.js');
const client = new Client({intents: 32767}); // 32767 => ALL intents
// Init the package, otherwise the events will not be emitted.
events.init(client);
client.on('ready', () => {
console.log(`Logged in as ${client.user.username}`);
});
client.on('channelNameUpdate', (channel, oldName, newName) => {
console.log(`A channel's name has been updated: "${oldName}" => "${newName}"`);
});
// Check the other events below.
| Parameter | Type | Description | | --- | --- | --- | | channel | GuildChannel | The channel whose name has been updated. | | oldName | String | The old channel's name. | | newName | String | The new channel's name |
Exemple :
client.on('channelNameUpdate', (channel, oldName, newName) => {
console.log(`A channel's name has been updated: "${oldName}" => "${newName}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | GuildChannel | The channel whose parent has been updated. | | oldParent | CategoryChannel | The old channel's parent. | | newParent | CategoryChannel | The new channel's parent. |
Example :
client.on('channelParentUpdate', (channel, oldParent, newParent) => {
console.log(`A channel's parent has been updated: ${oldParent.id} => ${newParent.id}`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | GuildChannel | The channel whose permissions have been updated. | | oldPermissions | PermissionOverwrites | The old channel's permissions. | | newPermissions | PermissionOverwrites | The new channel's permissions. |
Example :
client.on('channelPermissionOverwritesUpdate', (channel, oldPermissions, newPermissions) => {
console.log('The permissions of a channel have been updated :');
console.log(oldPermissions, newPermissions);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildTextChannel | The channel whose NSFW state has been updated. | | nsfw | Boolean | Wether the channel is NSFW or not. |
Example :
client.on('channelNsfwStateUpdate', (channel, nsfw) => {
console.log(`NSFW state has been ${nsfw ? 'enabled' : 'disabled'} in a channel.`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildTextChannel | The channel whose slowmode has been updated. | | oldRateLimit | Number | The old channel's slowmode (in seconds). | | newRateLimit | Number | The new channel's slowmode (in seconds). |
Example :
client.on('channelRateLimitUpdate', (channel, oldRateLimit, newRateLimit) => {
console.log(`A channel's slowmode has been updated: ${oldRateLimit} => ${newRateLimit}`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildTextChannel | The channel whose topic has been updated. | | oldTopic | String | The old channel's topic. | | newTopic | String | The new channel's topic. |
Example :
client.on('channelTopicUpdate', (channel, oldTopic, newTopic) => {
console.log(`A channel's topic has been updated: "${oldTopic}" => "${newTopic}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildVoiceChannel | The voice channel whose RTC region has been updated. | | oldRtcRegion | String | The old channel's RTC region. | | newRtcRegion | String | The new channel's RTC region |
Example :
client.on('channelRtcRegionUpdate', (channel, oldRtcRegion, newRtcRegion) => {
console.log(`A voice channel's RTC region has been updated: "${oldRtcRegion}" => "${newRtcRegion}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildVoiceChannel | The voice channel whose user limit has been updated. | | oldUserLimit | Number | The old channel's user limit. | | newUserLimit | Number | The new channel's user limit. |
Example :
client.on('channelUserLimitUpdate', (channel, oldUserLimit, newUserLimit) => {
console.log(`A voice channel's user limit has been updated: ${oldUserLimit} => ${newUserLimit}`);
});
| Parameter | Type | Description | | --- | --- | --- | | channel | BaseGuildVoiceChannel | The voice channel whose bitrate has been updated. | | oldBitrate | Number | The old channel's bitrate. | | newBitrate | Number | The new channel's bitrate. |
Example :
client.on('channelBitrateUpdate', (channel, oldBitrate, newBitrate) => {
console.log(`A voice channel's bitrate has been updated: ${oldBitrate} => ${newBitrate}`);
});
| Parameter | Type | Description | | --- | --- | --- | | emoji | BaseGuildEmoji | The emoji whose name has been updated. | | oldName | String | The old emoji's name. | | newName | String | The new emoji's name. |
Example :
client.on('emojiNameUpdate', (emoji, oldName, newName) => {
console.log(`An emoji's name has been updated: "${oldName}" => "${newName}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member whose nickname has been updated. | | oldNickname | String | undefined | The old guild member's nickname. | | newNickname | String | undefined | The new guild member's nickname. |
Example :
client.on('guildMemberNicknameUpdate', (member, oldNickname, newNickname) => {
console.log(`A guild member's nickname has been updated: "${oldNickname}" => "${newNickname}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who started boosting. |
Example :
client.on('guildMemberBoostStart', (member) => {
console.log(`A guild member started boosting the server "${member.guild.name}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who stopped boosting. |
Example :
client.on('guildMemberBoostStop', (member) => {
console.log(`A guild member stopped boosting the server "${member.guild.name}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who has been timed out. |
Example :
client.on('guildMemberTimeout', (member) => {
console.log(`${member.user.tag} has been timed out.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member whose timeout has been removed. |
Example :
client.on('guildMemberTimeoutRemove', (member) => {
console.log(`${member.user.tag} timeout has been removed.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who reveived the role. | | role | Role | The role that has been added to the guild member. |
Example :
client.on('guildMemberRoleAdd', (member, role) => {
console.log(`The "${role.name}" has been added to ${member.user.tag}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who lost the role. | | role | Role | The role that has been removed from the guild member. |
Example :
client.on('guildMemberRoleRemove', (member, role) => {
console.log(`The "${role.name}" has been removed from ${member.user.tag}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose banner has been updated. | | oldBannerURL | String | undefined | The old guild's banner URL. | | newBannerURL | String | undefined | The new guild's banner URL. |
Example :
client.on('guildBannerUpdate', (guild, oldBannerURL, newBannerURL) => {
console.log(`A guild's banner has been updated: ${oldBannerURL} => ${newBannerURL}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose description has been uptated. | | oldDescription | String | undefined | The old guild's description. | | newDescription | String | undefined | The new guild's description. |
Example :
client.on('guildDescriptionUpdate', (guild, oldDescription, newDescription) => {
console.log(`A guild's description has been updated: "${oldDescription}" => "${newDescription}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose icon has been updated. | | oldIconURL | String | undefined | The old guild's icon URL. | | newIconURL | String | undefined | The new guild's icon URL. |
Example :
client.on('guildIconUpdate', (guild, oldIconURL, newIconURL) => {*
console.log(`A guild's icon has been updated: ${oldIconURL} => ${newIconURL}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose name has been updated. | | oldName | String | The old guild's name. | | newName | String | The new guild's name. |
Example :
client.on('guildNameUpdate', (guild, oldName, newName) => {
console.log(`A guild's name has been updated: "${oldName}" => "${newName"`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose MFA level has been updated. | | oldMfaLevel | MFALevel | The old guild's MFA level. | | newMfaLevel | MFALevel | The new guild's MFA level. |
Example :
client.on('guildMfaLevelUpdate', (guild, oldMfaLevel, newMfaLevel) => {
console.log(`A guild's MFA level has been updated: "${oldMfaLevel}" => "${newMfaLevel}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose NSFW level has been updated. | | oldNsfwLevel | NSFWLevel | The old guild's NSFW level. | | newNsfwLevel | NSFWLevel | The new guild's NSFW level. |
Example :
client.on('guildNsfwLevelUpdate', (guild, oldNsfwLevel, newNsfwLevel) => {
console.log(`A guild's NSFW level has been updated: "${oldNsfwLevel}" => "${newNsfwLevel}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose AFK channel has been updated. | | oldAfkChannel | VoiceChannel | undefined | The old guild's AFK channel. | | newAfkChannel | VoiceChannel | undefined | The new guild's AFK channel. |
Example :
client.on('guildAfkChannelUpdate', (guild, oldAfkChannel, newAfkChannel) => {
console.log(`A guild's AFK channel has been updated: ${oldAfkChannel?.name} => ${newAfkChannel?.name}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose owner has been updated. | | oldOwner | User | The old guild's owner. | | newOwner | User | The new guild's owner. |
Example :
client.on('guildOwnerUpdate', (guild, oldOwner, newOwner) => {
console.log(`A guild's ownership has been transfered: ${oldOwner.tag} => ${newOwner.tag}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose owner has been updated. | | oldRulesChannel | TextChannel | undefined | The old guild's rules channel. | | newRulesChannel | TextChannel | undefined | The new guild's rules channel. |
Example :
client.on('guildRulesChannelUpdate', (guild, oldRulesChannel, newRulesChannel) => {
console.log(`A guild's rules channel has been updated: ${oldRulesChannel?.name} => ${newRulesChannel?.name}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild whose system channel has been updated. | | oldSystemChannel | TextChannel | undefined | The old guild' system channel. | | newSystemChannel | TextChannel | undefined | The new guild' system channel. |
Example :
client.on('guildSystemChannelUpdate', (guild, oldSystemChannel, newSystemChannel) => {
console.log(`A guild' system channel has been updated: ${oldSystemChannel?.name} => ${newSystemChannel?.name}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild that has been verified. |
Example :
client.on('guildVerified', (guild) => {
console.log(`The guild "${guild.name}" has been verified.`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild that has been verified. |
Example :
client.on('guildPartnered', (guild) => {
console.log(`The guild "${guild.name}" has been partnered.`);
});
| Parameter | Type | Description | | --- | --- | --- | | message | Message | The message that has been edited. | | oldContent | String | undefined | The old message's content. | | newContent | String | undefined | The new message's content. |
Example :
client.on('messageContentUpdate', (message, oldContent, newContent) => {
console.log(`A message has been edited in #${message.channel.name} channel: "${oldContent}" => "${newContent}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | message | Message | The message that has been edited. | | oldAttachments | Collection<Snowflake, MessageAttachment> | undefined | The old attachments of the message. | | newAttachments | Collection<Snowflake, MessageAttachment> | undefined | The new attachments of the message. |
Example :
client.on('messageAttachmentsUpdate', (message, oldAttachments, newAttachments) => {
console.log(`The attachments of a message have been updated :`);
console.log(oldAttachments, newAttachments);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member whose status has been updated. | | oldStatus | PresenceStatus | The old guild member's status. | | newStatus | PresenceStatus | The new guild member's status. |
Example :
client.on('guildMemberPresenceStatusUpdate', (member, oldStatus, newStatus) => {
console.log(`A guild member's status has been updated: ${oldStatus} => ${newStatus}`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who is now online. | | oldStatus | PresenceStatus | The old guild member's status. | | newStatus | PresenceStatus | The new guild member's status. |
Example :
client.on('guildMemberOnline', (member, oldStatus, newStatus) => {
console.log(`A guild member is now online (${newStatus})`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who is now offline. | | oldStatus | PresenceStatus | The old guild member's status. | | newStatus | PresenceStatus | The new guild member's status. |
Example :
client.on('guildMemberOnline', (member, oldStatus, newStatus) => {
console.log(`A guild member is now offline.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member whose activites have been updated. | | oldActivites | Array<Activity> | The old guild member's activites. | | newActivites | Array<Activity> | The new guild member's activities. |
Example :
client.on('guildMemberActivitiesUpdate', (member, oldActivites, newActivites) => {
console.log(`The activites of a guild member have been updated :`);
console.log(oldActivites, newActivites);
});
| Parameter | Type | Description | | --- | --- | --- | | role | Role | The role whose color has been updated. | | oldHexColor | String | The old role's hex color. | | newHexColor | String | The new role's hex color. |
Example :
client.on('roleColorUpdate', (role, oldHexColor, newHexColor) => {
console.log(`A role's color has been updated: ${oldHexColor} => ${newHexColor}`);
});
| Parameter | Type | Description | | --- | --- | --- | | role | Role | The role whose "hoist" option has been enabled/disabled. | | hoist | Boolean | Wether the role is hoisted or not. |
Example :
client.on('roleHoistUpdate', (role, hoist) => {
console.log(`A role hoist has been ${hoist ? 'enabled' : 'disabled'}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | role | Role | The role whose "mentionable" option has been enabled/disabled. | | mentionable | Boolean | Wether the role is mentionable or not. |
Example :
client.on('roleMentionableUpdate', (role, mentionable) => {
console.log(`The "mentionable" option of a role has been ${mentionable ? 'enabled' : 'disabled'}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | role | Role | The role whose icon has been updated. | | oldIconURL | String | undefined | The old role's icon URL. | | newIconURL | String | undefined | The new role's icon URL. |
Example :
client.on('roleIconUpdate', (role, oldIconURL, newIconURL) => {
console.log(`A role's icon has been updated: ${oldIconURL} => ${newIconURL}`);
});
| Parameter | Type | Description | | --- | --- | --- | | role | Role | The role whose permissions have been updated. | | oldPermissions | Readonly<Permissions> | The old role's permissions. | | newPermissions | Readonly<Permissions> | The new role's permissions. |
Example :
client.on('rolePermissionsUpdate', (role, oldPermissions, newPermissions) => {
console.log('The permissions of a role have been updated :');
console.log(oldPermissions, newPermissions)
});
| Parameter | Type | Description | | --- | --- | --- | | sticker | Sticker | The role whose permissions have been updated. | | oldName | String | The old sticker's name. | | newName | String | The new sticker's name. |
Example :
client.on('stickerNameUpdate', (sticker, oldName, newName) => {
console.log(`A sticker's name has been updated: "${oldName}" => "${newName}"`);
});
| Parameter | Type | Description | | --- | --- | --- | | thread | ThreadChannel | The thread where the guild member has been added. | | member | GuildMember | The guild member who has been added to the thread. |
Example :
client.on('threadMemberAdd', (thread, member) => {
console.log(`${member.user.tag} has been added to a thread.`);
});
| Parameter | Type | Description | | --- | --- | --- | | thread | ThreadChannel | The thread from where the guild member has been removed. | | member | GuildMember | The guild member who has been removed from the thread. |
Example :
client.on('threadMemberRemove', (thread, member) => {
console.log(`${member.user.tag} has been removed from a thread.`);
});
| Parameter | Type | Description | | --- | --- | --- | | thread | ThreadChannel | The thread that has been archived. |
Example :
client.on('threadArchived', (thread) => {
console.log(`The thread #${thread.name} has been archived.`);
});
| Parameter | Type | Description | | --- | --- | --- | | thread | ThreadChannel | The thread that has been unarchived. |
Example :
client.on('threadUnarchived', (thread) => {
console.log(`The thread #${thread.name} has been unarchived.`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild where the user is. | | user | User | The user whose avatar has been updated. | | oldAvatarURL | String | The old user's avatar URL. | | newAvatarURL | String | The new user's avatar URL. |
Example :
client.on('userAvatarUpdate', (guild, user, oldAvatarURL, newAvatarURL) => {
console.log(`A user's avatar has been updated: ${oldAvatarURL} => ${newAvatarURL}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild where the user is. | | user | User | The user whose banner has been updated. | | oldBannerURL | String | The old user's banner URL. | | newBannerURL | String | The new user's banner URL. |
Example :
client.on('userBannerUpdate', (guild, user, oldBannerURL, newBannerURL) => {
console.log(`A user's banner has been updated: ${oldBannerURL} => ${newBannerURL}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild where the user is. | | user | User | The user whose discriminator has been updated. | | oldDiscriminator | String | The old user's discriminator. | | newDiscriminator | String | The new user's discriminator. |
Example :
client.on('userDiscriminatorUpdate', (guild, user, oldDiscriminator, newDiscriminator) => {
console.log(`A user's discriminator has been updated: ${oldDiscriminator} => ${newDiscriminator}`);
});
| Parameter | Type | Description | | --- | --- | --- | | guild | BaseGuild | The guild where the user is. | | user | User | The user whose username has been updated. | | oldUsername | String | The old user's username. | | newUsername | String | The new user's username. |
Example :
client.on('userUsernameUpdate', (guild, user, oldUsername, newUsername) => {
console.log(`A user's username has been updated: ${oldUsername} => ${newUsername}`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who joined a voice channel. | | channel | BaseGuildVoiceChannel | The channel that the guild member joined. |
Example :
client.on('voiceChannelJoin', (member, channel) => {
console.log(`${member.user.tag} joined the voice channel #${channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who left a voice channel. | | channel | BaseGuildVoiceChannel | The channel that the guild member left. |
Example :
client.on('voiceChannelLeave', (member, channel) => {
console.log(`${member.user.tag} left the voice channel #${channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who left a voice channel. | | oldChannel | BaseGuildVoiceChannel | The channel that the guild member left. | | newChannel | BaseGuildVoiceChannel | The channel that the guild member joined. |
Example :
client.on('voiceChannelSwitch', (member, oldChannel, newChannel) => {
console.log(`${member.user.tag} left the #${oldChannel} to join #${newChannel}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who deafened himself. |
Example :
client.on('voiceChannelSelfDeaf', (member) => {
console.log(`${member.user.tag} deafened himself in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who muted himself. |
Example :
client.on('voiceChannelSelfMute', (member) => {
console.log(`${member.user.tag} muted himself in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who has been deafened. |
Example :
client.on('voiceChannelServerDeaf', (member) => {
console.log(`${member.user.tag} has been deafened in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who has been muted. |
Example :
client.on('voiceChannelServerMute', (member) => {
console.log(`${member.user.tag} has been muted in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who undeafened himself. |
Example :
client.on('voiceChannelSelfUndeaf', (member) => {
console.log(`${member.user.tag} undeafened himself in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who unmuted himself. |
Example :
client.on('voiceChannelSelfUnmute', (member) => {
console.log(`${member.user.tag} unmuted himself in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who has been undeafened. |
Example :
client.on('voiceChannelServerUndeaf', (member) => {
console.log(`${member.user.tag} has been server-undeafened in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who has been unmuted. |
Example :
client.on('voiceChannelServerUnmute', (member) => {
console.log(`${member.user.tag} has been server-unmuted in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who started streaming. |
Example :
client.on('voiceChannelStreamStart', (member) => {
console.log(`${member.user.tag} has started streaming in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who stopped streaming. |
Example :
client.on('voiceChannelStreamStop', (member) => {
console.log(`${member.user.tag} has stopped streaming in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who activated his camera. |
Example :
client.on('voiceChannelVideoStart', (member) => {
console.log(`${member.user.tag} has activated his camera in the voice channel #${member.voice.channel.name}.`);
});
| Parameter | Type | Description | | --- | --- | --- | | member | GuildMember | The guild member who deactivated his camera. |
Example :
client.on('voiceChannelVideoStop', (member) => {
console.log(`${member.user.tag} has deactivated his camera in the voice channel #${member.voice.channel.name}.`);
});