roleConverter top-level constant Null safety

Converter<IRole> const roleConverter

Converter to convert input to IRoles.

This uses multiple strategies to look up roles, in the order below:

  • ID lookup (parse input as snowflake)
  • Exact role name match
  • Full case insensitive role name match
  • Partial case insensitive role name match (role name starts with input)

Note that for all of these strategies, if multiple channels match any condition then no results will be given based off of that condition.


const Converter<IRole> roleConverter = FallbackConverter<IRole>(
    CombineConverter<Snowflake, IRole>(snowflakeConverter, snowflakeToRole),
  type: CommandOptionType.role,