roleConverter top-level constant Null safety

Converter<IRole> const roleConverter

A converter that converts input to an IRole.

This will first attempt to parse the input as a snowflake that will then be converted to an IRole. If this fails, then the role will be looked up by name in the current guild.

This converter has a Discord Slash Command argument type of CommandOptionType.role.

Implementation

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