Entity Info
parentID
$parentID
The $parentID function is an alias of $channelCategoryID (both have the same implementation). It returns the ID of the parent of a Discord channel: the category for a channel inside a category, or the parent channel for a thread.
Syntax
$parentID[(channelID)]
Parameters
| Parameter | Description |
|---|---|
channelID |
Optional. The ID of the target channel. If omitted, the current channel (channel.id context variable) is used. An ID that is not a positive integer raises Invalid channel ID.; an unknown channel raises Channel not found. |
Return Value
| Type | Description |
|---|---|
snowflake (string) |
The ID of the parent as reported by Discord, or "" if the channel has none. |
Examples
Category ID
$sendMessage[Category ID: $parentID]
Parent category name
$sendMessage[Parent category: $channelName[$parentID]]
Check if in a category
$if[$parentID!=]
$sendMessage[This channel is in the $channelName[$parentID] category]
$else
$sendMessage[This channel is not in a category.]
$endif
Notes
$parentIDis identical to$channelCategoryID.$categoryIDis a different function: it takes a category name and returns the ID of the category with that exact name.
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.