K
Docs
API Reference→Event Types→Message sent
💬

Message sent

messageCreateMESSAGE_CREATETrigger

Fires when a message is sent in a channel the bot can see.

When to use this
  • →Auto-moderation
  • →Keyword replies
  • →Logging messages

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 sent
messageCreate
Trigger
Filters
ignoreBots
true
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 message's unique ID
{{message.content}}The full text of the message
{{message.channelId}}ID of the channel the message was sent in
{{message.author.id}}Discord ID of who sent the message
{{message.author.username}}Sender's Discord username
{{message.author.displayName}}Sender's display name (or username if they have none)
{{message.author.name}}Sender's username (alias for message.author.username)
{{channel.id}}ID of the channel (same as message.channelId)
{{channel.name}}Name of the channel
{{message.image}}First image on the message — attachment, embed image or sticker
{{message.images}}Every image on the message, as a list
{{message.imageCount}}How many images the message carries
{{message.attachments}}Every file attached to the message (images or not)
{{message.author.avatar}}Avatar of whoever sent the message
{{message.url}}Link that jumps straight to the message
{{message.replyTo}}ID of the message this one replies to (empty if it isn't a reply)

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 message's unique ID
{{message.content}}stringThe full text of the message
{{message.channelId}}stringID of the channel the message was sent in
{{message.author.id}}stringDiscord ID of who sent the message
{{message.author.username}}stringSender's Discord username
{{message.author.displayName}}stringSender's display name (or username if they have none)
{{message.author.name}}stringSender's username (alias for message.author.username)
{{channel.id}}stringID of the channel (same as message.channelId)
{{channel.name}}stringName of the channel
{{message.image}}imageFirst image on the message — attachment, embed image or sticker
{{message.images}}arrayEvery image on the message, as a list
{{message.imageCount}}numberHow many images the message carries
{{message.attachments}}arrayEvery file attached to the message (images or not)
{{message.author.avatar}}imageAvatar of whoever sent the message
{{message.url}}stringLink that jumps straight to the message
{{message.replyTo}}stringID of the message this one replies to (empty if it isn't a reply)

Filters

Configure these in the trigger's filter panel to narrow when the flow fires.

FilterTypeDescription
ignoreBotsbooleanSkip messages from bot accounts (default: true)
📐

In TypeScript, this would be…

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

TypeScript
client.on("messageCreate", (message) => {
  if (message.author.bot) return;
  // {{message.content}}, {{message.author.id}}, {{channel.id}}
});