Skip to main content

Message Actions

Events for things that happen to messages after they are sent: deletions, edits, pins, replies and reactions.

Show the whole Message Actions flyout

The Message Actions subcategory

For the event that fires when a message is first sent, see Message.

When a message gets deleted​

Message deleted

Deleted message

message that got deleted is the message. This is the basis of a message logging channel.

info

Discord only reports deletions for messages your bot has seen since it started. A message posted before the last restart is not in the cache, so the deletion may come through with almost nothing in it.

When a reaction is added​

Reaction added

Companion blockReturns
userWho reacted.
messageThe message they reacted to.
emojiThe emoji they used.
countHow many people have used that emoji now.

Reaction roles, starboards and reaction-based confirmations all start here.

tip

Buttons are usually a better choice than reaction roles now. They are faster, they cannot be added by anyone but your bot, and the click tells you exactly who pressed what. See Buttons.

When a message is edited​

Message edited

Companion blockReturns
messageThe message, after the edit.
old contentWhat it said before.
new contentWhat it says now.

Having both versions is what makes an edit log worth reading.

When a message is pinned​

Message pinned

Pinned message

pinned message is the message that was pinned.

When a message is replied to​

Message replied to

Message received

Inside this event, message received is the reply itself. Use message that ... replied to from Message to get the original.

Message content​

Reading get content of message received for messages your bot was not mentioned in requires the Message Content Intent. Without it, the old and new content blocks come back empty. See Creating a Discord bot.

A worked example: a delete log​

  1. when a message gets deleted.
  2. Skip it if is user <author> a bot? is true, so your own messages do not fill the log.
  3. Send a message to your log channel with a container holding:
    • a text display naming the author and the channel
    • a separator
    • a text display with the deleted content
  4. Add a Discord timestamp with create timestamp from date from Time.