Entity Info
channelIDFromName
$channelIDFromName
Returns the ID of a Discord channel from its name.
Syntax
$channelIDFromName[name]
$channelIDFromName
The $channelIDFromName function returns the ID of a Discord channel from its name. The search is case-insensitive.
Syntax
$channelIDFromName[name]
Parameters
| Parameter | Description |
|---|---|
name |
The name of the channel to search for. Case-insensitive (e.g. general = General). |
Return value
| Type | Description |
|---|---|
snowflake (string) |
The ID of the channel found, or "" if no channel matches. |
Examples
Get the ID
$sendMessage[ID of general: $channelIDFromName[general]]
Send to a channel by name
$channelSendMessage[$channelIDFromName[announcements];New update available!]
Check existence
$if[$channelIDFromName[logs]!=]
$sendMessage[Channel #logs found! ID : $channelIDFromName[logs]]
$else
$sendMessage[No #logs channel found.]
$endif
Troubleshooting similar names
$if[$channelIDFromName[general]!=]
$sendMessage[Channel general found.]
$else
$sendMessage[Error: channel not found. Try another name.]
$endif
Notes
- If multiple channels share the same name, only the first one found is returned.
- Use
$findChannelfor a more advanced search with partial queries. - The name must not include the
#prefix.