userConverter top-level constant
A converter that converts input to a User
.
This will first attempt to parse the input to a snowflake which will then be converted to a
User
. If this fails, the input will be parsed as a Member which will then be converted to
a User
. If this fails, the user will be looked up by name.
This converter has a Discord Slash Command Argument Type of CommandOptionType.user.
Implementation
const Converter<User> userConverter = FallbackConverter<User>(
[
CombineConverter<Snowflake, User>(snowflakeConverter, snowflakeToUser),
CombineConverter<Member, User>(memberConverter, memberToUser),
Converter<User>(convertUser),
],
type: CommandOptionType.user,
toSelectMenuOption: userToSelectMenuOption,
toButton: userToButton,
);