Skip to main content
How to write an event file is in Events; the events about messages and their options in Messages; event() and its types in event().
An event is the name of an event() declaration. Each section below is one event: when its declarations run, the intents Discord needs for it (worked out from your files, never written by you), its options, what the bot remembers for it beyond the default, and what your function receives. Intents are named as chapterjs dev prints them. Three are privileged, to enable in the Developer Portal: GUILD_MEMBERS is the Server Members Intent, GUILD_PRESENCES the Presence Intent, MESSAGE_CONTENT the Message Content Intent.

What each event gives

What your function receives, event by event: what the event is about, and the server it happened in (guild). Every event also receives t, in the language of that server, when the project has a language. The type after a colon is the one of that object, detailed in the section of the event; where: 'dm' and where: 'both' narrow guild as each section says.

ready

Every event also receives t, in the language of the server it happened in, when the project has a language: see TranslationContext.
User
required
The bot itself.
ReadonlyMap<Snowflake, Guild>
required
The servers the bot is in.

guildJoin

Guild
required
The server the bot was added to.

guildLeave

Guild
required
The server as it was, when the bot was in it.

memberJoin

GuildMember
required
The new member.
Guild
required
The server they joined.

memberUpdate

GuildMember
required
The member, as they are now.
Guild
required
The server of the member.

memberLeave

User
required
The account of who left.
Guild
required
The server they left.

roleCreate

Role
required
The new role.
Guild
required
The server of the role.

roleUpdate

Role
required
The role, as it is now.
Guild
required
The server of the role.

roleDelete

Role
required
The role as it was.
Guild
required
The server the role was in.

channelCreate

GuildChannel | ThreadChannel
required
The new channel or thread.
Guild
required
The server of the channel: Discord only sends these events, with the Guilds intent, for the channels of a server.

channelUpdate

GuildChannel | ThreadChannel
required
The channel or thread, as it is now.
Guild
required
The server of the channel: Discord only sends these events, with the Guilds intent, for the channels of a server.

channelDelete

GuildChannel | ThreadChannel
required
The channel or thread as it was.
Guild
required
The server of the channel: Discord only sends these events, with the Guilds intent, for the channels of a server.

messageCreate

MemberMessage
required
The message that was sent. The type follows the options of the file: MemberMessage by default, GuildMessage with bots: true, DmMessage with where: 'dm', MemberMessage | PrivateMessage with where: 'both' (GuildMessage | PrivateMessage with both options). The four are in Message.
Guild
required
The server. With where: 'dm' it does not exist; with where: 'both' it is null for a private message.

messageUpdate

MemberMessage
required
The message, as it is now. The type follows the options of the file, like for messageCreate.
Guild
required
The server. With where: 'dm' it does not exist; with where: 'both' it is null for a private message.

messageDelete

What a file without where receives:
DeletedMessage
required
The message that was deleted.
Guild
required
The server the message was in.
With where: 'dm', guild does not exist, and in message channel is a DMChannel | null (the private conversation, when the bot knows it), before a DmMessage | null and guildId does not exist. With where: 'both', something private comes with guild: null, so guild tells the two apart.

reactionAdd

What a file without where receives:
AddedReaction
required
The reaction that was added.
Guild
required
The server.
With where: 'dm', guild does not exist, and in reaction channel is a DMChannel | null (the private conversation, when the bot knows it), message a DmMessage | null, and guildId and member do not exist; with 'both', a private reaction has guildId: null and member: null. With where: 'both', something private comes with guild: null, so guild tells the two apart.

reactionRemove

What a file without where receives:
UserReaction
required
The reaction that was removed.
Guild
required
The server.
With where: 'dm', guild does not exist, and in reaction channel is a DMChannel | null (the private conversation, when the bot knows it), message a DmMessage | null, and guildId and member do not exist; with 'both', a private reaction has guildId: null and member: null. With where: 'both', something private comes with guild: null, so guild tells the two apart.

reactionClear

What a file without where receives:
ClearedReactions
required
The reactions that were removed.
Guild
required
The server.
With where: 'dm', guild does not exist, and in reactions channel is a DMChannel | null (the private conversation, when the bot knows it), message a DmMessage | null and guildId does not exist. With where: 'both', something private comes with guild: null, so guild tells the two apart.

pollVoteAdd

What a file without where receives:
PollVote
required
The vote.
Guild
required
The server.
With where: 'dm', guild does not exist, and in vote channel is a DMChannel | null (the private conversation, when the bot knows it), message a DmMessage | null, and guildId and member do not exist; with 'both', a private vote has guildId: null and member: null. With where: 'both', something private comes with guild: null, so guild tells the two apart.

pollVoteRemove

Receives the same as pollVoteAdd: vote is the vote taken back.

typingStart

What a file without where receives:
Typing
required
Who is typing, and where.
Guild
required
The server.
With where: 'dm', guild does not exist, and in typing channel is a DMChannel | null (the private conversation, when the bot knows it), and guildId and member do not exist; with 'both', someone typing in private has guildId: null and member: null. With where: 'both', something private comes with guild: null, so guild tells the two apart.

threadMemberJoin

ThreadChannel
required
The thread.
GuildMember
required
Who was added, as a member of the server.
Guild
required
The server of the thread.

threadMemberLeave

ThreadChannel
required
The thread.
Snowflake
required
The id of who was removed.
GuildMember | null
required
Who was removed, as a member of the server, when the bot remembers it.
Guild
required
The server of the thread.

voiceJoin

VoiceActivity
required
Who joined, the channel, and their voice state.
Guild
required
The server of the channel.

voiceLeave

VoiceActivity
required
Who left, the channel they left, and their voice state as it was.
Guild
required
The server of the channel.

voiceMove

VoiceMove
required
Who moved, from where, to where.
Guild
required
The server of the channels.

voiceUpdate

VoiceChange
required
Who changed, their voice state now and before.
Guild
required
The server of the channel.

presenceUpdate

PresenceChange
required
The presence as it is now, and whose it is: the fields of UserPresence (status, activities, clientStatus), plus:
Guild
required
The server the change is seen from.

guildUpdate

Guild
required
The server, as it is now.

banAdd

User
required
The account that was banned.
Guild
required
The server they were banned from.

banRemove

User
required
The account that is no longer banned.
Guild
required
The server of the ban.

auditLogEntryCreate

AuditLogEntry
required
What was done, by whom, on what. See AuditLogEntry.
Guild
required
The server of the audit log.

emojiCreate

GuildEmoji
required
The new emoji.
Guild
required
The server of the emoji.

emojiUpdate

GuildEmoji
required
The emoji, as it is now.
Guild
required
The server of the emoji.

emojiDelete

GuildEmoji
required
The emoji as it was.
Guild
required
The server the emoji was in.

inviteCreate

Invite
required
The new invite. invite.channel is the channel it leads to.
Guild
required
The server the invite leads to.

inviteDelete

DeletedInvite
required
The invite that was deleted.
Guild
required
The server the invite led to.

scheduledEventCreate

ScheduledEvent
required
The new scheduled event: see ScheduledEvent.
Guild
required
The server of the scheduled event.

scheduledEventUpdate

ScheduledEvent
required
The scheduled event, as it is now.
Guild
required
The server of the scheduled event.

scheduledEventDelete

ScheduledEvent
required
The scheduled event as it was.
Guild
required
The server the scheduled event was in.

scheduledEventUserAdd

ScheduledEventInterest
required
Who is interested, in which scheduled event.
Guild
required
The server of the scheduled event.

scheduledEventUserRemove

ScheduledEventInterest
required
Who is no longer interested, in which scheduled event.
Guild
required
The server of the scheduled event.

When Discord only gives an id

Some events come with the id of who did it and nothing more: removing a reaction, voting, typing in private, being interested in a scheduled event. When the bot does not know that person yet, it asks Discord once before running your files, then remembers them: user is always there. Like for a channel the bot does not know, when Discord refuses, the event is not delivered and you are told: