Math & Text
randomChannelID
$randomChannelID[]
The $randomChannelID[] function returns the Discord ID of a random channel of the server where the command runs.
Syntax
$randomChannelID
Note: This function takes no arguments (it is an error to pass any).
Return Value
The Discord ID (snowflake) of a random channel, as a string, or an empty string if no channel is returned.
Behavior
- The candidates are all the channels returned by Discord for the server, whatever their type: text, voice, categories, and so on. Active threads are not included.
- It needs the Discord channel service of the running bot and a server context.
Examples
Get a random channel ID
Random channel ID: $randomChannelID
Mention a random channel
Random channel: <#$randomChannelID>
Notes
- Because voice channels and categories can be picked, the result is not always a channel you can send messages to.
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.