userConverter top-level constant Null safety
A converter that converts input to an IUser
.
This will first attempt to parse the input to a snowflake which will then be converted to an
IUser
. If this fails, the input will be parsed as an IMember which will then be converted to
an IUser
. 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<IUser> userConverter = FallbackConverter<IUser>(
[
CombineConverter<Snowflake, IUser>(snowflakeConverter, snowflakeToUser),
CombineConverter<IMember, IUser>(memberConverter, memberToUser),
Converter<IUser>(convertUser),
],
type: CommandOptionType.user,
);