getChannelOrFail<T extends PartialTextChannel> method

T getChannelOrFail<T extends PartialTextChannel>(
  1. String optionName
)

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

Example :

final Channel channel = interaction.getChannelOrFail('option_name');

Implementation

T getChannelOrFail<T extends PartialTextChannel> (String optionName) {
  return guild!.channels.cache.getOrFail(params[optionName]);
}