roleConverter top-level constant
A converter that converts input to a Role
.
This will first attempt to parse the input as a snowflake that will then be converted to a
Role
. 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<Role> roleConverter = FallbackConverter<Role>(
[
CombineConverter<Snowflake, Role>(snowflakeConverter, snowflakeToRole),
Converter<Role>(convertRole),
],
type: CommandOptionType.role,
toSelectMenuOption: roleToSelectMenuOption,
toButton: roleToButton,
);