1.0.2 β€’ Published 2 years ago

discord-events.js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Discord Events

πŸ“– 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.
ParameterTypeDescription
channelGuildChannelThe channel whose name has been updated.
oldNameStringThe old channel's name.
newNameStringThe new channel's name

Exemple :

client.on('channelNameUpdate', (channel, oldName, newName) => {
	console.log(`A channel's name has been updated: "${oldName}" => "${newName}"`);
});

ParameterTypeDescription
channelGuildChannelThe channel whose parent has been updated.
oldParentCategoryChannelThe old channel's parent.
newParentCategoryChannelThe new channel's parent.

Example :

client.on('channelParentUpdate', (channel, oldParent, newParent) => {
	console.log(`A channel's parent has been updated: ${oldParent.id} => ${newParent.id}`);
});

ParameterTypeDescription
channelGuildChannelThe channel whose permissions have been updated.
oldPermissionsPermissionOverwritesThe old channel's permissions.
newPermissionsPermissionOverwritesThe 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);
});

ParameterTypeDescription
channelBaseGuildTextChannelThe channel whose NSFW state has been updated.
nsfwBooleanWether the channel is NSFW or not.

Example :

client.on('channelNsfwStateUpdate', (channel, nsfw) => {
	console.log(`NSFW state has been ${nsfw ? 'enabled' : 'disabled'} in a channel.`);
});

ParameterTypeDescription
channelBaseGuildTextChannelThe channel whose slowmode has been updated.
oldRateLimitNumberThe old channel's slowmode (in seconds).
newRateLimitNumberThe new channel's slowmode (in seconds).

Example :

client.on('channelRateLimitUpdate', (channel, oldRateLimit, newRateLimit) => {
	console.log(`A channel's slowmode has been updated: ${oldRateLimit} => ${newRateLimit}`);
});

ParameterTypeDescription
channelBaseGuildTextChannelThe channel whose topic has been updated.
oldTopicStringThe old channel's topic.
newTopicStringThe new channel's topic.

Example :

client.on('channelTopicUpdate', (channel, oldTopic, newTopic) => {
	console.log(`A channel's topic has been updated: "${oldTopic}" => "${newTopic}"`);
});

ParameterTypeDescription
channelBaseGuildVoiceChannelThe voice channel whose RTC region has been updated.
oldRtcRegionStringThe old channel's RTC region.
newRtcRegionStringThe 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}"`);
});

ParameterTypeDescription
channelBaseGuildVoiceChannelThe voice channel whose user limit has been updated.
oldUserLimitNumberThe old channel's user limit.
newUserLimitNumberThe 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}`);
});

ParameterTypeDescription
channelBaseGuildVoiceChannelThe voice channel whose bitrate has been updated.
oldBitrateNumberThe old channel's bitrate.
newBitrateNumberThe new channel's bitrate.

Example :

client.on('channelBitrateUpdate', (channel, oldBitrate, newBitrate) => {
	console.log(`A voice channel's bitrate has been updated: ${oldBitrate} => ${newBitrate}`);
});
ParameterTypeDescription
emojiBaseGuildEmojiThe emoji whose name has been updated.
oldNameStringThe old emoji's name.
newNameStringThe new emoji's name.

Example :

client.on('emojiNameUpdate', (emoji, oldName, newName) => {
	console.log(`An emoji's name has been updated: "${oldName}" => "${newName}"`);
});
ParameterTypeDescription
memberGuildMemberThe guild member whose nickname has been updated.
oldNicknameString | undefinedThe old guild member's nickname.
newNicknameString | undefinedThe new guild member's nickname.

Example :

client.on('guildMemberNicknameUpdate', (member, oldNickname, newNickname) => {
	console.log(`A guild member's nickname has been updated: "${oldNickname}" => "${newNickname}"`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who started boosting.

Example :

client.on('guildMemberBoostStart', (member) => {
	console.log(`A guild member started boosting the server "${member.guild.name}"`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who stopped boosting.

Example :

client.on('guildMemberBoostStop', (member) => {
	console.log(`A guild member stopped boosting the server "${member.guild.name}"`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who has been timed out.

Example :

client.on('guildMemberTimeout', (member) => {
	console.log(`${member.user.tag} has been timed out.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member whose timeout has been removed.

Example :

client.on('guildMemberTimeoutRemove', (member) => {
	console.log(`${member.user.tag} timeout has been removed.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who reveived the role.
roleRoleThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who lost the role.
roleRoleThe 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}.`);
});
ParameterTypeDescription
guildBaseGuildThe guild whose banner has been updated.
oldBannerURLString | undefinedThe old guild's banner URL.
newBannerURLString | undefinedThe new guild's banner URL.

Example :

client.on('guildBannerUpdate', (guild, oldBannerURL, newBannerURL) => {
	console.log(`A guild's banner has been updated: ${oldBannerURL} => ${newBannerURL}`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose description has been uptated.
oldDescriptionString | undefinedThe old guild's description.
newDescriptionString | undefinedThe new guild's description.

Example :

client.on('guildDescriptionUpdate', (guild, oldDescription, newDescription) => {
	console.log(`A guild's description has been updated: "${oldDescription}" => "${newDescription}"`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose icon has been updated.
oldIconURLString | undefinedThe old guild's icon URL.
newIconURLString | undefinedThe new guild's icon URL.

Example :

client.on('guildIconUpdate', (guild, oldIconURL, newIconURL) => {*
	console.log(`A guild's icon has been updated: ${oldIconURL} => ${newIconURL}`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose name has been updated.
oldNameStringThe old guild's name.
newNameStringThe new guild's name.

Example :

client.on('guildNameUpdate', (guild, oldName, newName) => {
	console.log(`A guild's name has been updated: "${oldName}" => "${newName"`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose MFA level has been updated.
oldMfaLevelMFALevelThe old guild's MFA level.
newMfaLevelMFALevelThe new guild's MFA level.

Example :

client.on('guildMfaLevelUpdate', (guild, oldMfaLevel, newMfaLevel) => {
	console.log(`A guild's MFA level has been updated: "${oldMfaLevel}" => "${newMfaLevel}"`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose NSFW level has been updated.
oldNsfwLevelNSFWLevelThe old guild's NSFW level.
newNsfwLevelNSFWLevelThe new guild's NSFW level.

Example :

client.on('guildNsfwLevelUpdate', (guild, oldNsfwLevel, newNsfwLevel) => {
	console.log(`A guild's NSFW level has been updated: "${oldNsfwLevel}" => "${newNsfwLevel}"`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose AFK channel has been updated.
oldAfkChannelVoiceChannel | undefinedThe old guild's AFK channel.
newAfkChannelVoiceChannel | undefinedThe 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}`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose owner has been updated.
oldOwnerUserThe old guild's owner.
newOwnerUserThe new guild's owner.

Example :

client.on('guildOwnerUpdate', (guild, oldOwner, newOwner) => {
   console.log(`A guild's ownership has been transfered: ${oldOwner.tag} => ${newOwner.tag}`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose owner has been updated.
oldRulesChannelTextChannel | undefinedThe old guild's rules channel.
newRulesChannelTextChannel | undefinedThe 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}`);
});

ParameterTypeDescription
guildBaseGuildThe guild whose system channel has been updated.
oldSystemChannelTextChannel | undefinedThe old guild' system channel.
newSystemChannelTextChannel | undefinedThe new guild' system channel.

Example :

client.on('guildSystemChannelUpdate', (guild, oldSystemChannel, newSystemChannel) => {
   console.log(`A guild' system channel has been updated: ${oldSystemChannel?.name} => ${newSystemChannel?.name}`);
});

ParameterTypeDescription
guildBaseGuildThe guild that has been verified.

Example :

client.on('guildVerified', (guild) => {
   console.log(`The guild "${guild.name}" has been verified.`);
});

ParameterTypeDescription
guildBaseGuildThe guild that has been verified.

Example :

client.on('guildPartnered', (guild) => {
   console.log(`The guild "${guild.name}" has been partnered.`);
});
ParameterTypeDescription
messageMessageThe message that has been edited.
oldContentString | undefinedThe old message's content.
newContentString | undefinedThe 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}"`);
});

ParameterTypeDescription
messageMessageThe message that has been edited.
oldAttachmentsCollection<Snowflake, MessageAttachment> | undefinedThe old attachments of the message.
newAttachmentsCollection<Snowflake, MessageAttachment> | undefinedThe 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);
});
ParameterTypeDescription
memberGuildMemberThe guild member whose status has been updated.
oldStatusPresenceStatusThe old guild member's status.
newStatusPresenceStatusThe new guild member's status.

Example :

client.on('guildMemberPresenceStatusUpdate', (member, oldStatus, newStatus) => {
   console.log(`A guild member's status has been updated: ${oldStatus} => ${newStatus}`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who is now online.
oldStatusPresenceStatusThe old guild member's status.
newStatusPresenceStatusThe new guild member's status.

Example :

client.on('guildMemberOnline', (member, oldStatus, newStatus) => {
   console.log(`A guild member is now online (${newStatus})`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who is now offline.
oldStatusPresenceStatusThe old guild member's status.
newStatusPresenceStatusThe new guild member's status.

Example :

client.on('guildMemberOnline', (member, oldStatus, newStatus) => {
   console.log(`A guild member is now offline.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member whose activites have been updated.
oldActivitesArray[Activity](https://discord.js.org/#/docs/discord.js/stable/class/Activity)The old guild member's activites.
newActivitesArray[Activity](https://discord.js.org/#/docs/discord.js/stable/class/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);
});
ParameterTypeDescription
roleRoleThe role whose color has been updated.
oldHexColorStringThe old role's hex color.
newHexColorStringThe new role's hex color.

Example :

client.on('roleColorUpdate', (role, oldHexColor, newHexColor) => {
   console.log(`A role's color has been updated: ${oldHexColor} => ${newHexColor}`);
});

ParameterTypeDescription
roleRoleThe role whose "hoist" option has been enabled/disabled.
hoistBooleanWether the role is hoisted or not.

Example :

client.on('roleHoistUpdate', (role, hoist) => {
   console.log(`A role hoist has been ${hoist ? 'enabled' : 'disabled'}.`);
});

ParameterTypeDescription
roleRoleThe role whose "mentionable" option has been enabled/disabled.
mentionableBooleanWether 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'}.`);
});

ParameterTypeDescription
roleRoleThe role whose icon has been updated.
oldIconURLString | undefinedThe old role's icon URL.
newIconURLString | undefinedThe new role's icon URL.

Example :

client.on('roleIconUpdate', (role, oldIconURL, newIconURL) => {
   console.log(`A role's icon has been updated: ${oldIconURL} => ${newIconURL}`);
});

ParameterTypeDescription
roleRoleThe role whose permissions have been updated.
oldPermissionsReadonly[Permissions](https://discord.js.org/#/docs/discord.js/stable/class/Permissions)The old role's permissions.
newPermissionsReadonly[Permissions](https://discord.js.org/#/docs/discord.js/stable/class/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)
});
ParameterTypeDescription
stickerStickerThe role whose permissions have been updated.
oldNameStringThe old sticker's name.
newNameStringThe new sticker's name.

Example :

client.on('stickerNameUpdate', (sticker, oldName, newName) => {
   console.log(`A sticker's name has been updated: "${oldName}" => "${newName}"`);
});
ParameterTypeDescription
threadThreadChannelThe thread where the guild member has been added.
memberGuildMemberThe 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.`);
});

ParameterTypeDescription
threadThreadChannelThe thread from where the guild member has been removed.
memberGuildMemberThe 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.`);
});
ParameterTypeDescription
threadThreadChannelThe thread that has been archived.

Example :

client.on('threadArchived', (thread) => {
   console.log(`The thread #${thread.name} has been archived.`);
});

ParameterTypeDescription
threadThreadChannelThe thread that has been unarchived.

Example :

client.on('threadUnarchived', (thread) => {
   console.log(`The thread #${thread.name} has been unarchived.`);
});
ParameterTypeDescription
guildBaseGuildThe guild where the user is.
userUserThe user whose avatar has been updated.
oldAvatarURLStringThe old user's avatar URL.
newAvatarURLStringThe new user's avatar URL.

Example :

client.on('userAvatarUpdate', (guild, user, oldAvatarURL, newAvatarURL) => {
   console.log(`A user's avatar has been updated: ${oldAvatarURL} => ${newAvatarURL}`);
});

ParameterTypeDescription
guildBaseGuildThe guild where the user is.
userUserThe user whose banner has been updated.
oldBannerURLStringThe old user's banner URL.
newBannerURLStringThe new user's banner URL.

Example :

client.on('userBannerUpdate', (guild, user, oldBannerURL, newBannerURL) => {
   console.log(`A user's banner has been updated: ${oldBannerURL} => ${newBannerURL}`);
});

ParameterTypeDescription
guildBaseGuildThe guild where the user is.
userUserThe user whose discriminator has been updated.
oldDiscriminatorStringThe old user's discriminator.
newDiscriminatorStringThe new user's discriminator.

Example :

client.on('userDiscriminatorUpdate', (guild, user, oldDiscriminator, newDiscriminator) => {
   console.log(`A user's discriminator has been updated: ${oldDiscriminator} => ${newDiscriminator}`);
});

ParameterTypeDescription
guildBaseGuildThe guild where the user is.
userUserThe user whose username has been updated.
oldUsernameStringThe old user's username.
newUsernameStringThe new user's username.

Example :

client.on('userUsernameUpdate', (guild, user, oldUsername, newUsername) => {
   console.log(`A user's username has been updated: ${oldUsername} => ${newUsername}`);
});
ParameterTypeDescription
memberGuildMemberThe guild member who joined a voice channel.
channelBaseGuildVoiceChannelThe channel that the guild member joined.

Example :

client.on('voiceChannelJoin', (member, channel) => {
   console.log(`${member.user.tag} joined the voice channel #${channel.name}.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who left a voice channel.
channelBaseGuildVoiceChannelThe channel that the guild member left.

Example :

client.on('voiceChannelLeave', (member, channel) => {
   console.log(`${member.user.tag} left the voice channel #${channel.name}.`);
});

ParameterTypeDescription
memberGuildMemberThe guild member who left a voice channel.
oldChannelBaseGuildVoiceChannelThe channel that the guild member left.
newChannelBaseGuildVoiceChannelThe channel that the guild member joined.

Example :

client.on('voiceChannelSwitch', (member, oldChannel, newChannel) => {
   console.log(`${member.user.tag} left the #${oldChannel} to join #${newChannel}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`); 
});

ParameterTypeDescription
memberGuildMemberThe 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}.`); 
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});

ParameterTypeDescription
memberGuildMemberThe 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}.`);
});