Entity Info mentionedChannels

$mentionedChannels

Returns the list of channel IDs mentioned in the message (via

Syntax
$mentionedChannels

$mentionedChannels

The function $mentionedChannels returns the list of channel IDs mentioned in the message, via the #channel syntax.

Syntax

$mentionedChannels

Return Value

  • Type : List of snowflakes separated by commas
  • Example: 123456789,987654321
  • Empty string if no channels are mentioned

Behavior

  • $mentionedChannels takes no arguments.
  • Detects channel mentions formatted as #channel-name.
  • Returns the IDs of the mentioned channels.

Examples

Check mentioned channels

$if[$mentionedChannels!=]
  $let[channels;$splitText[$mentionedChannels;,]]
  $let[count;$arrayCount[$channels]]
  $sendMessage[$count channel(s) mentioned.]
$else
  $sendMessage[No channels mentioned in this message.]
$endif

Act on the first mentioned channel

$if[$mentionedChannels!=]
  $let[firstChannel;$splitText[$mentionedChannels;,;1]]
  $sendMessage[First channel mentioned: <#$firstChannel>]
$endif

Move a message

$if[$mentionedChannels!=]
  $let[target;$splitText[$mentionedChannels;,;1]]
  $sendMessage[Message to <#$target>]
$endif

Notes

  • Channel mentions use the #channel-name format in Discord.
  • The returned IDs are numeric snowflakes.
  • To get the name of a channel from its ID, use $channelName[ID].