K
Docs
API Reference→Event Types→Message deleted
🗑️

Message deleted

messageDeleteMESSAGE_DELETETrigger

Fires when a message is deleted.

When to use this
  • →Mod-log deleted messages
  • →Anti-ghost-ping detection

On the canvas

This is what the trigger looks like in your bot's Triggers tab. The sparks listed are available in every node inside the linked flow.

🗑️
Message deleted
messageDelete
Trigger
Sparks in this flow
{{input.guild.id}}Your Discord server's unique ID
{{input.guild.name}}Your server's name
{{input.guild.memberCount}}How many members are in the server
{{input.guild.icon}}Your server's icon image (empty if it has none)
{{message.id}}The deleted message's ID
{{message.content}}The deleted message's text (empty if message was not cached)
{{message.channelId}}ID of the channel the message was in
{{message.author.id}}Who sent the message (may be empty for uncached messages)
{{message.author.name}}Sender's username (may be empty for uncached messages)
{{channel.id}}ID of the channel (same as message.channelId)

Available sparks

Use these in any piece config field inside flows triggered by this event.

SparkTypeDescription
{{input.guild.id}}stringYour Discord server's unique ID
{{input.guild.name}}stringYour server's name
{{input.guild.memberCount}}stringHow many members are in the server
{{input.guild.icon}}imageYour server's icon image (empty if it has none)
{{message.id}}stringThe deleted message's ID
{{message.content}}stringThe deleted message's text (empty if message was not cached)
{{message.channelId}}stringID of the channel the message was in
{{message.author.id}}stringWho sent the message (may be empty for uncached messages)
{{message.author.name}}stringSender's username (may be empty for uncached messages)
{{channel.id}}stringID of the channel (same as message.channelId)
📐

In TypeScript, this would be…

Not something you need to write — Kitcord registers these listeners automatically from your Kit.

TypeScript
client.on("messageDelete", (message) => {
  // {{message.content}} may be empty if uncached
});