$afkChannelID

Returns the servers AFK channel ID (returns an error if there isn’t such a channel).

What is this?

An AFK channel on Discord is a voice channel where inactive users are automatically moved after being idle for a set time (Can be returned via $afkTimeout). It keeps active channels clear of idle users.

Syntax

$afkChannelID

Example

$nomention
AFK channel ID: $afkChannelID
!example AFK channel ID: 567428769766440962

How to stop the error message?

The $afkChannelID function as said in above returns an error if there isn’t any AFK channel set on the server and there is a way to stop that.

$nomention
$try 
  AFK channel ID: $afkChannelID
$catch
  No AFK channel found!
$endtry
  • Without try block:
!example ❌ Function $afkChannelID at 3:31 returned an error: No AFK channel set in this server!
  • With try block:
!example No AFK channel found!

For more information, read the Error Handling guide.