getMemberOrFail method

GuildMember getMemberOrFail(
  1. String optionName
)

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

Example :

final GuildMember member = interaction.getMemberOrFail('option_name');

Implementation

GuildMember getMemberOrFail (String optionName) {
  return guild!.members.cache.getOrFail(params[optionName]);
}