Entity Info
afkChannelID
$afkChannelID[] — AFK Channel
$afkChannelID[] returns the ID of the AFK channel configured on the server where the command runs (the afk_channel_id setting of the server).
Syntax
$afkChannelID
Parameters
| Parameter | Description | Required |
|---|---|---|
| None |
Return value
- Type:
string - The ID of the AFK channel.
- If the server has no AFK channel, the function does not return an empty string: it raises the error
No AFK channel set in this server. - Outside a server (no guild in the context) the lookup fails with
Guild channel settings require a guild.
Examples
Displaying the AFK channel
$try
$sendMessage[💤 AFK Channel: <#$afkChannelID> (delay: $afkTimeout seconds)]
$catch
$sendMessage[ℹ️ No AFK channel is configured on this server.]
$endTry
Configuration log
$log[Server configuration $serverName | AFK: $afkChannelID | Timeout: $afkTimeout]
Notes
- Because an unset channel raises an error, wrap the call in
$try/$catch/$endTrywhen the server may not have one. - The inactivity delay is given by
$afkTimeout[](in seconds). - Similar functions:
$rulesChannelIDand$systemChannelID, which raise the same kind of error when the channel is not set.
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.