java.lang.Object
dev.sympho.modular_commands.utils.parse.EntityParser<E>
dev.sympho.modular_commands.utils.parse.MentionableParser<C>
dev.sympho.modular_commands.utils.parse.ChannelParser<C>
- Type Parameters:
C- The channel type.
- All Implemented Interfaces:
ParserFunction<String,,C> BiFunction<CommandContext,String, Mono<C>>
A parser that extracts a channel 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.Retrieves the parser to use for URLs, if supported.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
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
-
ChannelParser
Creates a new instance.- Parameters:
type- The type of channel.
-
-
Method Details
-
getUrlParser
Description copied from class:EntityParserRetrieves the parser to use for URLs, if supported.- Overrides:
getUrlParserin classEntityParser<C extends @NonNull Channel>- Returns:
- The URL parser, or
nullif URLs are not supported.
-
getEntity
Description copied from class:EntityParserRetrieves the entity with the given ID.- Specified by:
getEntityin classEntityParser<C extends @NonNull Channel>- 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<C extends @NonNull Channel>- Parameters:
mention- The text mention.- Returns:
- The ID in the mention.
- Throws:
InvalidArgumentException- if the mention was invalid.
-