getRole method

Role? getRole(
  1. String optionName
)

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

Example :

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

Implementation

Role? getRole (String optionName) {
  return guild?.roles.cache.get(data[optionName]?['value']);
}