Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9
An in-depth discord.js event cheatsheet, containing all events along with example usages.
armfuldev/discord.js-cheatsheet
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This guide will go over all of the Discord.js events and how to use them, along with examples. You can use this information in many ways, but the most common would be creating a log system for your Discord bot. I don't suggest just copy pasting, try implementing this with your own code. Happy reading!
If you want to just copy the code you can do sohere.
- Channel Events
- Client User Events:
- Debug Events:
- Error Events:
- WebSocket Events:
- Emoji Events:
- Guild Events:
- Guild Member Events:
- Interaction Event:
- Message Events:
- Client Events:
- Role Events:
- User Events:
- Voice Events:
// PARAMETER TYPE DESCRIPTION// channel Channel The channel that was createdclient.on('channelCreate',function(channel){console.log(`channelCreate:${channel}`);});
// PARAMETER TYPE DESCRIPTION// channel Channel The channel that was deletedclient.on('channelDelete',function(channel){console.log(`channelDelete:${channel}`);});
Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, not much information can be provided easily here.
// PARAMETER TYPE DESCRIPTION// channel Channel The channel that the pins update occurred in// time Date The time of the pins updateclient.on('channelPinsUpdate',function(channel,time){console.log(`channelPinsUpdate:${channel}:${time}`);});
// PARAMETER TYPE DESCRIPTION// oldChannel Channel The channel before the update// newChannel Channel The channel after the updateclient.on('channelUpdate',function(oldChannel,newChannel){console.log(`channelUpdate -> a channel is updated - e.g. name change, topic change`);});
// PARAMETER TYPE DESCRIPTION// clientUserGuildSettings ClientUserGuildSettings The new client user guild settingsclient.on('clientUserGuildSettingsUpdate',function(clientUserGuildSettings){console.log(`clientUserGuildSettingsUpdate -> client user's settings update`);});
// PARAMETER TYPE DESCRIPTION// clientUserSettings ClientUserSettings The new client user settingsclient.on('clientUserSettingsUpdate',function(clientUserSettings){console.log(`clientUserSettingsUpdate -> client user's settings update`);});
// PARAMETER TYPE DESCRIPTION// info string The debug informationclient.on('debug',function(info){console.log(`debug ->${info}`);});
// PARAMETER TYPE DESCRIPTION// error Error The encountered errorclient.on('error',function(error){console.error(`client's WebSocket encountered a connection error:${error}`);});
// PARAMETER TYPE DESCRIPTION// info string The warningclient.on('warn',function(info){console.log(`warn:${info}`);});
// PARAMETER TYPE DESCRIPTION// Event CloseEvent The WebSocket close eventclient.on('disconnect',function(event){console.log(`The WebSocket has closed and will no longer attempt to reconnect`);});
client.on('reconnecting',function(){console.log(`client tries to reconnect to the WebSocket`);});
// PARAMETER TYPE DESCRIPTION// replayed number The number of events that were replayedclient.on('resume',function(replayed){console.log(`whenever a WebSocket resumes,${replayed} replays`);});
// PARAMETER TYPE DESCRIPTION// emoji Emoji The emoji that was createdclient.on('emojiCreate',function(emoji){console.log(`a custom emoji is created in a guild`);});
// PARAMETER TYPE DESCRIPTION// emoji Emoji The emoji that was deletedclient.on('emojiDelete',function(emoji){console.log(`a custom guild emoji is deleted`);});
// PARAMETER TYPE DESCRIPTION// oldEmoji Emoji The old emoji// newEmoji Emoji The new emojiclient.on('emojiUpdate',function(oldEmoji,newEmoji){console.log(`a custom guild emoji is updated`);});
// PARAMETER TYPE DESCRIPTION// guild Guild The guild that the ban occurred in// user User The user that was bannedclient.on('guildBanAdd',function(guild,user){console.log(`a member is banned from a guild`);});
// PARAMETER TYPE DESCRIPTION// guild Guild The guild that the unban occurred in// user User The user that was unbannedclient.on('guildBanRemove',function(guild,user){console.log(`a member is unbanned from a guild`);});
// PARAMETER TYPE DESCRIPTION// guild Guild The created guildclient.on('guildCreate',function(guild){console.log(`the client joins a guild`);});
// PARAMETER TYPE DESCRIPTION// guild Guild The guild that was deletedclient.on('guildDelete',function(guild){console.log(`the client deleted/left a guild`);});
// PARAMETER TYPE DESCRIPTION// guild Guild The guild that has become unavailableclient.on('guildUnavailable',function(guild){console.error(`a guild becomes unavailable, likely due to a server outage:${guild}`);});
// PARAMETER TYPE DESCRIPTION// oldGuild Guild The guild before the update// newGuild Guild The guild after the updateclient.on('guildUpdate',function(oldGuild,newGuild){console.error(`a guild is updated`);});
// PARAMETER TYPE DESCRIPTION// member GuildMember The member that has joined a guildclient.on('guildMemberAdd',function(member){console.log(`a user joins a guild:${member.tag}`);});
// PARAMETER TYPE DESCRIPTION// member GuildMember The member that became availableclient.on('guildMemberAvailable',function(member){console.log(`member becomes available in a large guild:${member.tag}`);});
// PARAMETER TYPE DESCRIPTION// member GuildMember The member that has left/been kicked from the guildclient.on('guildMemberRemove',function(member){console.log(`a member leaves a guild, or is kicked:${member.tag}`);});
// PARAMETER TYPE DESCRIPTION// members Array<GuildMember> The members in the chunk// guild Guild The guild related to the member chunkclient.on('guildMembersChunk',function(members,guild){console.error(`a chunk of guild members is received`);});
// PARAMETER TYPE DESCRIPTION// oldMember GuildMember The member before the update// newMember GuildMember The member after the updateclient.on('guildMemberUpdate',function(oldMember,newMember){console.error(`a guild member changes - i.e. new role, removed role, nickname.`);});
// PARAMETER TYPE DESCRIPTION// oldMember GuildMember The member before the presence update// newMember GuildMember The member after the presence updateclient.on('presenceUpdate',function(oldMember,newMember){console.log(`a guild member's presence changes`);});
// PARAMETER TYPE DESCRIPTION// interaction Interaction The interaction which was createdclient.on('interactionCreate',function(interaction){console.log(`interaction is created ->${interaction}`);});
// PARAMETER TYPE DESCRIPTION// message Message The created messageclient.on('messageCreate',function(message){console.log(`message is created ->${message}`);});
// PARAMETER TYPE DESCRIPTION// message Message The deleted messageclient.on('messageDelete',function(message){console.log(`message is deleted ->${message}`);});
// PARAMETER TYPE DESCRIPTION// messages Collection<Snowflake, Message> The deleted messages, mapped by their IDclient.on('messageDeleteBulk',function(messages){console.log(`messages are deleted ->${messages}`);});
// PARAMETER TYPE DESCRIPTION// messageReaction MessageReaction The reaction object// user User The user that applied the emoji or reaction emojiclient.on('messageReactionAdd',function(messageReaction,user){console.log(`a reaction is added to a message`);});
// PARAMETER TYPE DESCRIPTION// messageReaction MessageReaction The reaction object// user User The user that removed the emoji or reaction emojiclient.on('messageReactionRemove',function(messageReaction,user){console.log(`a reaction is removed from a message`);});
// PARAMETER TYPE DESCRIPTION// message Message The message the reactions were removed fromclient.on('messageReactionRemoveAll',function(message){console.error(`all reactions are removed from a message`);});
// PARAMETER TYPE DESCRIPTION// oldMessage Message The message before the update// newMessage Message The message after the updateclient.on('messageUpdate',function(oldMessage,newMessage){console.log(`a message is updated`);});
// PARAMETER TYPE DESCRIPTION// channel Channel The channel the user started typing in// user User The user that started typingclient.on('typingStart',function(channel,user){console.log(`${user.tag} has started typing`);});
// PARAMETER TYPE DESCRIPTION// channel Channel The channel the user stopped typing in// user User The user that stopped typingclient.on('typingStop',function(channel,user){console.log(`${user.tag} has stopped typing`);});
client.on('ready',function(){console.log(`Logged in as${client.user.tag}!`);});
// PARAMETER TYPE DESCRIPTION// role Role The role that was createdclient.on('roleCreate',function(role){console.error(`a role is created`);});
// PARAMETER TYPE DESCRIPTION// role Role The role that was deletedclient.on('roleDelete',function(role){console.error(`a guild role is deleted`);});
// PARAMETER TYPE DESCRIPTION// oldRole Role The role before the update// newRole Role The role after the updateclient.on('roleUpdate',function(oldRole,newRole){console.error(`a guild role is updated`);});
// PARAMETER TYPE DESCRIPTION// user User The user the note belongs to// oldNote String The note content before the update// newNote String The note content after the updateclient.on('userNoteUpdate',function(user,oldNote,newNote){console.log(`a member's note is updated`);});
// PARAMETER TYPE DESCRIPTION// oldUser User The user before the update// newUser User The user after the updateclient.on('userUpdate',function(oldUser,newUser){console.log(`user's details (e.g. username) are changed`);});
// PARAMETER TYPE DESCRIPTION// oldMember GuildMember The member before the voice state update// newMember GuildMember The member after the voice state updateclient.on('voiceStateUpdate',function(oldMember,newMember){console.log(`a user changes voice state`);});
Feel free to reach out to me for support.
By:armful#0001
About
An in-depth discord.js event cheatsheet, containing all events along with example usages.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.

