$findChannel

Searches for a channel by its ID, mention, or name.

Usage:

$findChannel[ID/mention/name;returnCurrentChannel (yes/no) (optional)]

Parameters:

  • ID/mention/name: The ID, mention, or name of the channel to search for.
  • returnCurrentChannel (yes/no) (optional): Determines the behavior when a channel isn't found:
    • yes: (Default) Returns the current channel's ID if no match is found.
    • no: Returns undefined if no match is found.

Example Scenarios:

Scenario 1: Channel Found (using channel name)

Member04/23/2025
!!exec $findChannel[bot-commands;no]
Custom Command Bot 04/23/2025
869243919697846379

In this example, the bot searches for a channel named "bot-commands". If found, it returns the channel's ID (869243919697846379). The ;no tells the function to return undefined if the channel isn't found.

Scenario 2: Channel Not Found (with returnCurrentChannel set to no)

Member04/23/2025
!!exec $findChannel[bot-cmnds;no]
Custom Command Bot 04/23/2025
undefined

Here, the bot attempts to find a channel named "bot-cmnds" (note the typo). Since no such channel exists, and the second argument is set to no, the function returns undefined.

Related Functions

$channelExists is useful for verifying if a channel ID exists before using it.

Function Difficulty: Medium
Tags: channel find find Channel search Channel