$findServerChannel
This function allows you to search for a specific channel within your Discord server. You can identify the channel by its name, mention, or ID.
The last parameter determines what the function returns: the channel's ID or undefined
if the channel is not found.
Syntax
$findServerChannel[query;returnCurrentChannel (yes/no) (optional)]
Parameters:
query
: (Required) The name, mention (e.g.,<#1234567890>
), or ID of the channel you're looking for.returnCurrentChannel
: (Optional) Specify whether to return the current channel's ID if not found.yes
: Returns the channel's ID.no
: Returnsundefined
if the channel is not found. Defaults tono
if omitted.
Example
In this example, we're searching for a channel named "general" and telling the function not to return anything if the channel is not found.
Related functions
- $findMember: Find a member in the server.
- $findRole: Find a role in the server.
- $findChannel: Find a channel (works across servers if the bot is in multiple).