getRoleOrFail method

Role getRoleOrFail(
  1. String optionName
)

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

Example :

Role? role = interaction.getRole('option_name');

Implementation

Role getRoleOrFail (String optionName) {
  return guild!.roles.cache.getOrFail(params[optionName]);
}