Skip to content
Entity Info lastMessageID

$lastMessageID

The function $lastMessageID returns the ID of the last message sent in the current channel.

Syntax

$lastMessageID

Parameters

None. $lastMessageID takes no argument and always targets the current channel.

Return Value

Type Description
snowflake (string) The ID of the last message in the channel, or an empty string if the channel has none.

Examples

Last message of the current channel

$sendMessage[Last message in this channel: $lastMessageID]

Check recent activity

$if[$lastMessageID==$messageID]
  $sendMessage[Your message is the last one in this channel!]
$endif
$sendMessage[Last message: https://discord.com/channels/$guildID/$channelID/$lastMessageID]

Notes

  • If the channel has no message, the result is an empty string.
  • The channel is fetched from Discord using the current channel ID; a channel that cannot hold messages raises Channel does not support messages.

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.