getChannel<T extends GuildChannel> method

T getChannel<T extends GuildChannel>(
  1. String optionName
)

Returns an instance of PartialTextChannel or null if the command has the designed option

Example :

Channel? channel = interaction.getChannel('option_name');

Implementation

T getChannel<T extends GuildChannel>(String optionName) {
  return guild?.channels.cache.get(params[optionName]) as T;
}