BuildcordDocs

Events

The server events an event flow can react to, and the tokens each one provides.

An event flow runs when one of these happens. Events need a gateway bot. Each is delivered to the bot under a gateway intent, which the builder adds to the blueprint for you.

EventFires whenIntent
Member joinsSomeone joins the server.GuildMembers
Member leavesSomeone leaves or is removed.GuildMembers
Member changesSomeone's roles, nickname or timeout change.GuildMembers
Server boostedA member starts boosting.GuildMembers
Member banned, Member unbannedSomeone is banned, or a ban is lifted.GuildModeration
Message sentAny message in a channel the bot can read.GuildMessages
Message editedSomeone edits a message.GuildMessages
Message deletedA message is deleted.GuildMessages
Reaction added, Reaction removedSomeone reacts to a message, or takes a reaction away.GuildMessageReactions
Joins voiceA member connects to a voice channel.GuildVoiceStates
Moves voice channelA member moves from one voice channel to another.GuildVoiceStates
Leaves voiceA member disconnects from voice.GuildVoiceStates
Thread createdA new thread or forum post.Guilds
Channel created, Channel deletedA channel or category is added or removed.Guilds
Role created, Role deletedA role is added or removed.Guilds
Invite createdSomeone makes an invite link.GuildInvites

Privileged intents

Discord restricts some intents, such as reading message content and listening to members, and you turn them on for your bot in the Discord developer portal. The blueprint lists the privileged ones separately so the builder can flag them.

What came before

Discord says what something is now, not what it was. For Member changes, Message edited, Message deleted, Moves voice channel and Leaves voice, the bot remembers what it has seen since it connected (the last few thousand messages, the members and who is in voice) to say what changed. Right after a restart or a deploy, a message sent before then has no {message.before}, and a member's first change has no {member.rolesAdded}.

Every event also has {user.id}, {user.name} and {user.mention} for who did it, when Discord says, and {server.id}. Steps that act on "the member" act on them.

Member joins

TokenValue
{member.joinedAt}When they joined
{member.accountAge}How old their Discord account is, in seconds
{user.createdAt}When their account was made, in seconds since 1970

Member leaves

TokenValue
{member.roles}The roles they had, when the bot had seen them

Member changes

TokenValue
{member.roles}Their roles now, as IDs separated by commas
{member.rolesAdded}, {member.rolesRemoved}The roles just given and taken away
{member.nickname}, {member.nicknameBefore}Their nickname now and before
{member.timedOut}true if they're timed out now

It doesn't fire for changes nobody can see, such as a new avatar.

Server boosted

TokenValue
{server.boosts}How many boosts the server now has
{server.boostTier}The server's boost level

Member banned, Member unbanned

{user.mention} and the rest are who was banned or unbanned.

Message sent

TokenValue
{message.content}The text of the message
{message.link}A link straight to the message
{message.id}The message's ID
{message.attachments}How many files are attached
{message.author}, {message.author.id}Who sent it
{message.mentions}Everyone the message mentions
{message.roleMentions}The roles it mentions
{message.replyTo}, {message.replyTo.id}The text and ID of the message it replies to
{member.roles}The sender's roles

Message edited

The same as Message sent for the message as it is now, and {message.before}: what it said before.

Message deleted

TokenValue
{message.id}The message's ID
{message.content}What it said, when the bot saw it sent
{user.mention}Who wrote it, when the bot saw it sent

Reaction added

TokenValue
{reaction.emoji}The emoji that was added
{message.id}, {message.link}The message reacted to
{message.content}, {message.author}What it said and who wrote it, when the bot saw it sent

Reaction removed

TokenValue
{reaction.emoji}The emoji that was taken away
{message.id}, {message.link}The message
{user.mention}Who took it away

Joins voice

TokenValue
{voice.channel}The voice channel they joined
{voice.memberCount}How many people are now in the channel

Moves voice channel

TokenValue
{voice.channel}The channel they moved to
{voice.previousChannel}The one they came from
{voice.memberCount}How many are now in the new channel

Leaves voice

TokenValue
{voice.channel}The channel they left
{voice.memberCount}How many are left in it

Thread created

TokenValue
{thread.name}The thread's title
{thread.id}, {thread.parent}The thread, and the channel or forum it was made in
{thread.link}A link straight to the thread

Channel created, Channel deleted

TokenValue
{channel.name}, {channel.id}, {channel.mention}The channel
{channel.type}text, voice, category, announcement, forum or stage
{channel.parent}The category it's in

Role created, Role deleted

TokenValue
{role.id}The role's ID
{role.name}, {role.mention}For a new role: its name and a mention

Invite created

TokenValue
{invite.url}, {invite.code}The invite
{invite.channel}The channel it lands in
{invite.maxUses}How many times it can be used, 0 for no limit
{invite.expiresIn}How many seconds it lasts, 0 for ever
{user.mention}Who made it

On this page