Class UserParser
java.lang.Object
dev.sympho.modular_commands.utils.parse.EntityParser<E>
dev.sympho.modular_commands.utils.parse.MentionableParser<User>
dev.sympho.modular_commands.utils.parse.UserParser
- All Implemented Interfaces:
ParserFunction<String,,User> BiFunction<CommandContext,String, Mono<User>>
A parser that extracts an user from a string.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
ParserFunction.PostParser<R extends @NonNull Object,I extends @NonNull Object, T extends @NonNull Object, P1 extends @NonNull ParserFunction<R, I>, P2 extends @NonNull ParserFunction<I, T>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEntity(CommandContext context, Snowflake id) Retrieves the entity with the given ID.parseMention(String mention) Parses the entity ID from a text mention.Methods inherited from class dev.sympho.modular_commands.utils.parse.MentionableParser
extractId, parseMentionMethods inherited from class dev.sympho.modular_commands.utils.parse.EntityParser
getUrlParser, parse, parseIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply, then
-
Constructor Details
-
UserParser
public UserParser()Creates a new instance.
-
-
Method Details
-
getEntity
Description copied from class:EntityParserRetrieves the entity with the given ID.- Specified by:
getEntityin classEntityParser<User>- Parameters:
context- The execution context.id- The entity ID.- Returns:
- The entity. May be empty if not found.
-
parseMention
Description copied from class:MentionableParserParses the entity ID from a text mention.- Specified by:
parseMentionin classMentionableParser<User>- Parameters:
mention- The text mention.- Returns:
- The ID in the mention.
- Throws:
InvalidArgumentException- if the mention was invalid.
-