How to log deleted messages on Discord

Discord doesn't show what a deleted message said. A logging bot does: it posts each deletion and edit, with the old text, to a channel only your staff can see, along with members joining and leaving. The logging template has those flows drawn. It reacts to server events, so it runs on Buildcord Boost, the $8-a-month plan.

5 stepsNo codeUses the Server log templateUpdated

Steps

  1. Make a private log channel

    Create a channel such as logs and allow only your moderators and the bot to see it.

  2. Turn on two intents

    In the Discord Developer Portal, on your application's Bot page, turn on Message Content Intent to log what messages said and Server Members Intent to log joins and leaves.

  3. Start from the logging template

    Open the logging template in Buildcord. It makes a bot with an event flow for each of Member joins, Member leaves, Message edited and Message deleted.

  4. Point it at your channel

    In each flow's Send to a channel step, choose your log channel. Change the wording or the embed's color if you like.

  5. Deploy and test

    Paste your token and deploy. Send a message from a test account, edit it, then delete it. Both should appear in the log within a second or two.

Good to know

  • The bot can only say what a message said if it saw it sent, so messages from before it went live are logged without their text.
  • An edit shows the text before as {message.before} and after as {message.content}.
  • Add more events the same way: Member banned, Member changes for role and nickname changes, Channel deleted, Role created and Invite created.
  • Skip bots with a Member check, so other bots' clean-up doesn't flood the log.

Questions

Can the log say who deleted a message?

No. Discord tells bots which message was deleted and who wrote it, but not who deleted it. Moderator deletions are in your server's audit log.

Can I see messages that were deleted before I added the bot?

No. The bot only knows the text of messages it saw sent while it was running.

Are logged messages stored anywhere else?

Not as the template comes. They are posted to your log channel. Add an Add row step if you want them in a collection too.

More guides

Draw the first flow.

A command, a reply and a deploy is a working bot. It takes a few minutes.

Start buildingOpen dashboard