Skip to content
Entity Info categoryChannels

$categoryChannels

The $categoryChannels function returns the channels belonging to a specific category, identified by its ID. By default it returns their names.

Syntax

$categoryChannels[categoryID;separator;(option)]

Parameters

Parameter Description
categoryID The ID of the category. Required. The ID must be a positive number and must belong to a guild category, otherwise the function raises an error (Invalid category ID. / Channel is not a guild category.).
separator Required. Text inserted between the items.
option Optional. name (default), id, mention (<#ID>) or count. With count, the number of channels is returned and the separator is unused. Any other value raises an error.

Return value

Type Description
string The channels of the category (names, IDs or mentions) joined by the separator, or their count with the count option.

Examples

Channels in the current category

$sendMessage[**Channels in this category:** $categoryChannels[$channelCategoryID;, ]]

List with newlines

$sendMessage[
**Channels in the category:**
$categoryChannels[$channelCategoryID;
]]

Channels of a specific category

$sendMessage[Admin channels: $categoryChannels[123456789012345678;, ]]

Check if a category is empty

$if[$categoryChannels[$channelCategoryID;,;count]==0]
  $sendMessage[This category does not contain any channels.]
$endif

Notes

  • Only the channels whose parent is the category are listed; the category itself is not included. Threads are not listed.
  • The order is the one in which Discord returns the server’s channels.
  • If the current channel has no category, $channelCategoryID is empty and the call fails with Invalid category ID.
  • Use $channelCategoryID to get the category of the current channel.
  • To list all channels on the server, use $channelNames.

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.