Entity Info
mentionedChannels
$mentionedChannels
The function $mentionedChannels returns the list of channel IDs mentioned in the message, via the #channel syntax.
Syntax
bdfd
$mentionedChannels
Syntax
$mentionedChannels
Return Value
- Type : List of snowflakes separated by commas
- Example:
123456789,987654321 - Empty string if no channels are mentioned
Behavior
$mentionedChannelstakes no arguments.- Detects channel mentions formatted as
#channel-name. - Returns the IDs of the mentioned channels.
Examples
Check mentioned channels
$if[$mentionedChannels!=]
$var[channels;$splitText[$mentionedChannels;,]]
$var[count;$arrayCount[$var[channels]]]
$sendMessage[$var[count] channel(s) mentioned.]
$else
$sendMessage[No channels mentioned in this message.]
$endif
Act on the first mentioned channel
$if[$mentionedChannels!=]
$var[firstChannel;$splitText[$mentionedChannels;,;1]]
$sendMessage[First channel mentioned: <#$var[firstChannel]>]
$endif
Move a message
$if[$mentionedChannels!=]
$var[target;$splitText[$mentionedChannels;,;1]]
$sendMessage[Message to <#$var[target]>]
$endif
Notes
- Channel mentions use the
#channel-nameformat in Discord. - The returned IDs are numeric snowflakes.
- To get the name of a channel from its ID, use
$channelName[ID].