diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/annotation/parameter/Content.java b/src/main/java/com/github/breadmoirai/breadbot/framework/annotation/parameter/Content.java index c28a2af8..901d4d6a 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/annotation/parameter/Content.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/annotation/parameter/Content.java @@ -19,12 +19,12 @@ /** * Type of content. - * + * * * @return the content type. */ diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java index 662a104d..911637c4 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/BreadBotBuilder.java @@ -576,15 +576,6 @@ public BreadBotBuilder addPreProcessPredicate(Predicate predicate) { return this; } - /** - * Not much use for this at the moment. - */ - public BreadBotBuilder setEventFactory(CommandEventFactory commandEventFactory) { - this.commandEventFactory = commandEventFactory; - return this; - } - - /** * This will allow messages to be re-evaluated on message edit. * This will also evaluate commands that are unpinned. diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java index c8a5eeb1..fc2c04e1 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandParameterBuilder.java @@ -112,7 +112,7 @@ public interface CommandParameterBuilder { * By default this is set to -1. * * @param limit An int determining the maximum amount of arguments to contain. - * @return this + * @return this. */ CommandParameterBuilder setLimit(int limit); @@ -132,9 +132,10 @@ default CommandParameterBuilder configure(Consumer conf CommandParameter build(); /** - * Sets the default mapping for a parameter in case none is found + * Sets the default mapping for a parameter in case none is found. * - * @param defaultValue a function that produces a value + * @param defaultValue a function that produces a value. + * @return this. */ CommandParameterBuilder setDefaultValue(Function defaultValue); diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java index 4d39f8da..81ba9507 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPluginBuilder.java @@ -60,13 +60,14 @@ public interface CommandPluginBuilder { * Finds and returns the first Module that is assignable to the provided {@code moduleClass} * * @param moduleClass The class of the Module to find + * @param the plugin type * @return The module if found. Else {@code null}. */ M getPlugin(Class moduleClass); /** * This adds a module that implements {@link PrefixPlugin} to provide a static prefix that cannot be changed. If a {@link PrefixPlugin} is not added, one will be provided with a static prefix of {@code "!"} - *

+ * *

This method's implementation is: *

 {@link CommandPluginBuilder#addPlugin(CommandPlugin) addModule}(new {@link UnmodifiablePrefixPlugin DefaultPrefixModule}(prefix)) 
* @@ -84,13 +85,13 @@ default CommandPluginBuilder addStaticPrefix(String prefix) { * This ensures that Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} are only usable by Administrators. *

It is important to include an implementation of {@link AdminPlugin AdminModule} through either this method, {@link BreadBotBuilder#addAdminPlugin(Predicate)}, or your own implementation. * Otherwise, all users will have access to Administrative Commands - *

+ * *

The default criteria for defining an Administrator is as follows: *

    *
  • Has Kick Members Permission
  • *
  • Is higher than the bot on the role hierarchy
  • *
- *

+ * *

Different criteria to determine which member has administrative status with {@link BreadBotBuilder#addAdminPlugin(Predicate)} * or your own implementation of {@link AdminPlugin} * @@ -102,7 +103,7 @@ default CommandPluginBuilder addAdminPlugin() { /** * Define custom behavior to determine which members can use Commands marked with {@link com.github.breadmoirai.breadbot.plugins.admin.Admin @Admin} - *

+ * *

This method's implementation is: *

 {@link #addPlugin(CommandPlugin) addModule}(new {@link AdminPluginImpl DefaultAdminModule}(isAdmin)) 
* diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPropertiesManager.java b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPropertiesManager.java index 77518f22..5475bb5e 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPropertiesManager.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/builder/CommandPropertiesManager.java @@ -39,22 +39,25 @@ public interface CommandPropertiesManager { /** * The provided {@code configurator} is used to modify commands that possess the specified property. * This behavior is added onto any existing behavior. - * When a command is registered with that property (usually an annotation), the provided {@code configurator} is applied. + * When a command is registered with that property (usually an annotation), the provided {@code configurator} is + * applied. * If there are already commands registered, the {@code configurator} is applied to those as well. * * @param propertyType the class of the property * @param configurator a {@link BiConsumer BiConsumer}. - * The first argument is the property. - * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to. - * @param the propertyType + * The first argument is the property. + * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to. + * @param the propertyType + * @return this, for chaining. */ - CommandPropertiesManager bindCommandModifier(Class propertyType, BiConsumer configurator); + CommandPropertiesManager bindCommandModifier(Class propertyType, + BiConsumer configurator); /** * Removes any existing behavior attached to this parameter. * * @param parameterType the class of the parameter. - * @return this. + * @return this, for chaining. */ CommandPropertiesManager clearParameterModifiers(Class parameterType); @@ -66,11 +69,13 @@ public interface CommandPropertiesManager { * * @param propertyType the class of the property * @param configurator a {@link BiConsumer BiConsumer}. - * The first argument is the property. - * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to. - * @param the propertyType + * The first argument is the property. + * The second argument is the {@link CommandHandleBuilder CommandHandleBuilder} the property is attached to. + * @param the propertyType + * @return this, for chaining. */ - CommandPropertiesManager bindParameterModifier(Class propertyType, BiConsumer configurator); + CommandPropertiesManager bindParameterModifier(Class propertyType, + BiConsumer configurator); /** * Applies modifiers to a CommandHandleBuilder based on whether the handle contains a property. @@ -83,7 +88,7 @@ public interface CommandPropertiesManager { * Retrieves a BiConsumer that is used to modify a CommandHandleBuilder. * * @param propertyType the class of the Property. - * @param the property type. + * @param the property type. * @return a BiConsumer if present, otherwise {@code null}. * @see #clearCommandModifiers(Class) * @see #bindCommandModifier(Class, BiConsumer) @@ -95,10 +100,9 @@ public interface CommandPropertiesManager { * Applies a modifier that is associated with a certain {@code propertyType} to the passed {@code builder}. * If a modifier is not found the {@code builder} is not modified. * - * * @param propertyType the property class - * @param builder the CommandHandleBuilder to be modified - * @param the property type + * @param builder the CommandHandleBuilder to be modified + * @param the property type * @see #clearCommandModifiers(Class) (Class) * @see #bindCommandModifier(Class, BiConsumer) * @see #getCommandModifier(Class) @@ -116,7 +120,7 @@ public interface CommandPropertiesManager { * Retrieves a BiConsumer that is used to modify a CommandParameterBuilder. * * @param propertyType the class of the Property. - * @param the property type. + * @param the property type. * @return a BiConsumer if present, otherwise {@code null}. * @see #clearParameterModifiers(Class) * @see #bindParameterModifier(Class, BiConsumer) @@ -129,8 +133,8 @@ public interface CommandPropertiesManager { * If a modifier is not found the {@code builder} is not modified. * * @param propertyType the property class - * @param builder the CommandHandleBuilder to be modified - * @param the property type + * @param builder the CommandHandleBuilder to be modified + * @param the property type * @see #clearParameterModifiers(Class) (Class, BiConsumer) * @see #bindParameterModifier(Class, BiConsumer) * @see #getParameterModifier(Class) @@ -138,52 +142,71 @@ public interface CommandPropertiesManager { void applyParameterModifier(Class propertyType, CommandParameterBuilder builder); /** - * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property. + * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the + * property. * - * @param identifier a name for the preprocessor + * @param identifier a name for the preprocessor * @param propertyType the property class - * @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction} + * @param function a {@link CommandPreprocessorFunction#process CommandPreprocessorFunction} + * @return this, for chaining. */ - default CommandPropertiesManager bindPreprocessor(String identifier, Class propertyType, CommandPreprocessorFunction function) { - bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, function))); + default CommandPropertiesManager bindPreprocessor(String identifier, Class propertyType, + CommandPreprocessorFunction function) { + bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor( + new CommandPreprocessor(identifier, function))); return this; } /** - * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property. + * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the + * property. * - * @param identifier a name for the preprocessor + * @param identifier a name for the preprocessor * @param propertyType the property class - * @param factory a function that generates a preprocessor based upon the value of the property - * @param the property type + * @param factory a function that generates a preprocessor based upon the value of the property + * @param the property type + * @return this, for chaining. */ - default CommandPropertiesManager bindPreprocessorFactory(String identifier, Class propertyType, Function factory) { - bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, factory.apply(t)))); + default CommandPropertiesManager bindPreprocessorFactory(String identifier, Class propertyType, + Function factory) { + bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor( + new CommandPreprocessor(identifier, factory.apply(t)))); return this; } /** - * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property. + * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the + * property. * - * @param identifier a name for the preprocessor + * @param identifier a name for the preprocessor * @param propertyType the property class - * @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false} otherwise + * @param predicate a {@link java.util.function.Predicate Predicate}{@literal <}{@link CommandEvent + * CommandEvent}{@literal >} that returns {@code true} when the command should continue to execute, {@code false} + * otherwise + * @return this, for chaining. */ - default CommandPropertiesManager bindPreprocessorPredicate(String identifier, Class propertyType, CommandPreprocessorPredicate predicate) { - bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, predicate))); + default CommandPropertiesManager bindPreprocessorPredicate(String identifier, Class propertyType, + CommandPreprocessorPredicate predicate) { + bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor( + new CommandPreprocessor(identifier, predicate))); return this; } /** - * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the property. + * Associates a preprocessor with a property. This does not replace any existing preprocessors associated with the + * property. * - * @param identifier a name for the preprocessor + * @param identifier a name for the preprocessor * @param propertyType the property class - * @param factory a function that generates a preprocessor predicate based upon the value of the property - * @param the property type + * @param factory a function that generates a preprocessor predicate based upon the value of the property + * @param the property type + * @return this. */ - default CommandPropertiesManager bindPreprocessorPredicateFactory(String identifier, Class propertyType, Function factory) { - bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor(new CommandPreprocessor(identifier, factory.apply(t)))); + default CommandPropertiesManager bindPreprocessorPredicateFactory(String identifier, Class propertyType, + Function + factory) { + bindCommandModifier(propertyType, (t, commandHandleBuilder) -> commandHandleBuilder.addPreprocessor( + new CommandPreprocessor(identifier, factory.apply(t)))); return this; } @@ -191,6 +214,13 @@ default CommandPropertiesManager bindPreprocessorPredicateFactory(String ide CommandPropertiesManager setPreprocessorPriority(String... identifiers); + /** + * Sets the order in which preprocessors are evaluated + * + * @param identifierList a list of strings that contain the names of each preprocessor. If there is a null value in + * the list, all unmatched preprocessors will be put in that spot. + * @return this. + */ CommandPropertiesManager setPreprocessorPriority(List identifierList); Comparator getPriorityComparator(); diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/command/CommandResultHandler.java b/src/main/java/com/github/breadmoirai/breadbot/framework/command/CommandResultHandler.java index 006ba865..e56a4d5d 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/command/CommandResultHandler.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/command/CommandResultHandler.java @@ -21,7 +21,7 @@ /** * This handles the result of a command, in other terms the returned value from invoking a command method * - * @param + * @param the result type */ @FunctionalInterface public interface CommandResultHandler { diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java index 93f03a3b..ce6f3363 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/event/CommandEvent.java @@ -44,6 +44,8 @@ import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.entities.User; import net.dv8tion.jda.core.events.Event; +import net.dv8tion.jda.core.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.core.requests.ErrorResponse; import net.dv8tion.jda.core.requests.RestAction; import net.dv8tion.jda.core.utils.PermissionUtil; @@ -125,7 +127,6 @@ private int countDepth(Command command) { * Whatever comes after the prefix and the keys. * * @return a {@link java.lang.String String} that does not contain the prefix or any of the keys. - * * @see CommandEvent#getArguments() */ public abstract String getContent(); @@ -135,6 +136,7 @@ private int countDepth(Command command) { /** * The {@link net.dv8tion.jda.core.entities.User User} who invoked the command. * + * @return the author of the message * @see CommandEvent#getMember() */ public abstract User getAuthor(); @@ -144,6 +146,7 @@ private int countDepth(Command command) { /** * The {@link net.dv8tion.jda.core.entities.Member Member} who invoked the command. * + * @return the author of the message * @see CommandEvent#getAuthor() */ public abstract Member getMember(); @@ -152,7 +155,6 @@ private int countDepth(Command command) { * The currently logged-in account as a {@link net.dv8tion.jda.core.entities.SelfUser SelfUser}. * * @return in this case, Samurai. - * * @see CommandEvent#getSelfMember() */ public abstract SelfUser getSelfUser(); @@ -162,7 +164,6 @@ private int countDepth(Command command) { * net.dv8tion.jda.core.entities.Guild Guild} in which this command was invoked. * * @return in this case, Samurai as a {@link net.dv8tion.jda.core.entities.Member Member}. - * * @see CommandEvent#getSelfUser() */ public abstract Member getSelfMember(); @@ -206,9 +207,7 @@ public int getArgumentCount() { * CommandEvent#getArguments()} * * @param index the index of the argument starting at 0. This does not include the key. - * * @return the non-null CommandArgument - * * @throws IndexOutOfBoundsException if the index is less than 0 or greater than * {@link CommandEvent#getArgumentCount()} */ @@ -221,7 +220,6 @@ public CommandArgument getArgumentAt(int index) { * with quotes or backticks. * * @return a CommandArgumentList - * * @see CommandEvent#getArguments(ArgumentSplitter) * @see CommandEvent#setDefaultArgumentLimit */ @@ -232,6 +230,7 @@ public CommandArgumentList getArguments() { /** *

Parses {@link CommandEvent#getContent() getContent()} according to the splitter. * + * @param splitter an {@link ArgumentSplitter} that provides an iterator, separating this into arguments * @return an implementation of {@link java.util.List}<{@link CommandArgument EventArgument}> */ public synchronized CommandArgumentList getArguments(ArgumentSplitter splitter) { @@ -258,9 +257,7 @@ public synchronized CommandArgumentList getArguments(ArgumentSplitter splitter) * * @param regex the regex to split on * @param limit the split limit - * * @return a new {@link CommandArgumentList}. - * * @see java.util.regex.Pattern#split(java.lang.CharSequence, int) */ public CommandArgumentList createNewArgumentList(String regex, int limit) { @@ -271,10 +268,8 @@ public CommandArgumentList createNewArgumentList(String regex, int limit) { * Creates a new list of arguments using the provided regex to split the message contents. * * @param splitter the pattern to split on - * @param limit the split limit - * + * @param limit the split limit * @return a new {@link CommandArgumentList}. - * * @see java.util.regex.Pattern#split(java.lang.CharSequence, int) */ public CommandArgumentList createNewArgumentList(Pattern splitter, int limit) { @@ -320,7 +315,6 @@ public CommandResponseMessage.RMessageBuilder replyFormat(String format, Object. * Checks to see if the bot has the permissions required. * * @param permission any permissions required. - * * @return {@code true} if the bot has the permissions required. {@code false} otherwise. */ public boolean checkPermission(Permission... permission) { @@ -333,7 +327,6 @@ public boolean checkPermission(Permission... permission) { * method returns {@code false}. * * @param permission the permissions required. - * * @return {@code false} if the bot has the permissions required. {@code true} otherwise. */ public boolean requirePermission(Permission... permission) { @@ -345,9 +338,8 @@ public boolean requirePermission(Permission... permission) { * notified with a message and this method returns {@code true}. If the required permissions are present, this * method returns {@code false}. * - * @param channel the channel for which to check permissions on + * @param channel the channel for which to check permissions on * @param permission the permissions required. - * * @return {@code false} if the bot has the permissions required. {@code true} otherwise. */ public boolean requirePermission(Channel channel, Permission... permission) { @@ -380,9 +372,8 @@ public String toString() { * mentioned {@link net.dv8tion.jda.core.entities.User Users}.
If no user was mentioned, this list is empty. * * @return immutable list of mentioned users - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public List getMentionedUsers() { return getMessage().getMentionedUsers(); @@ -390,16 +381,15 @@ public List getMentionedUsers() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getMentionedChannels} - *

+ * *

A immutable list of all mentioned {@link net.dv8tion.jda.core.entities.TextChannel TextChannels}.
If none * were mentioned, this list is empty. - *

+ * *

This may include TextChannels from other {@link net.dv8tion.jda.core.entities.Guild Guilds} * * @return immutable list of mentioned TextChannels - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public List getMentionedChannels() { return getMessage().getMentionedChannels(); @@ -407,16 +397,15 @@ public List getMentionedChannels() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getMentionedRoles} - *

+ * *

A immutable list of all mentioned {@link net.dv8tion.jda.core.entities.Role Roles}.
If none were * mentioned, this list is empty. - *

+ * *

This may include Roles from other {@link net.dv8tion.jda.core.entities.Guild Guilds} * * @return immutable list of mentioned Roles - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public List getMentionedRoles() { return getMessage().getMentionedRoles(); @@ -424,18 +413,16 @@ public List getMentionedRoles() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getMentionedMembers} - *

+ * *

Creates an immutable list of {@link net.dv8tion.jda.core.entities.Member Members} representing the users of * {@link #getMentionedUsers()} in the specified {@link net.dv8tion.jda.core.entities.Guild Guild}.
This is only * a convenience method and will skip all users that are not in the specified Guild. * * @param guild Non-null {@link net.dv8tion.jda.core.entities.Guild Guild} that will be used to retrieve Members. - * * @return Immutable list of mentioned Members - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} - * @throws IllegalArgumentException If the specified Guild is {@code null} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * @throws IllegalArgumentException If the specified Guild is {@code null} * @since 3.4.0 */ public List getMentionedMembers(Guild guild) { @@ -444,7 +431,7 @@ public List getMentionedMembers(Guild guild) { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getMentionedMembers} - *

+ * *

Creates an immutable list of {@link net.dv8tion.jda.core.entities.Member Members} representing the users of * {@link #getMentionedUsers()} in the {@link net.dv8tion.jda.core.entities.Guild Guild} this Message was sent in. *
This is only a convenience method and will skip all users that are not in the specified Guild.
It will @@ -452,11 +439,10 @@ public List getMentionedMembers(Guild guild) { * {@link #getMentionedMembers(net.dv8tion.jda.core.entities.Guild)}. * * @return Immutable list of mentioned Members - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} - * @throws IllegalStateException If this message was not sent in a {@link net.dv8tion.jda.core.entities - * .TextChannel TextChannel} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * @throws IllegalStateException If this message was not sent in a {@link net.dv8tion.jda.core.entities + * .TextChannel TextChannel} * @since 3.4.0 */ public List getMentionedMembers() { @@ -465,21 +451,19 @@ public List getMentionedMembers() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getMentions} - *

+ * *

Combines all instances of {@link net.dv8tion.jda.core.entities.IMentionable IMentionable} filtered by the * specified {@link net.dv8tion.jda.core.entities.Message.MentionType MentionType} values.
This does not include * {@link #getMentionedMembers()} to avoid duplicates. - *

+ * *

If no MentionType values are given this will fallback to all types. * * @param types Amount of {@link net.dv8tion.jda.core.entities.Message.MentionType MentionTypes} to include in the - * list of mentions - * + * list of mentions * @return Immutable list of filtered {@link net.dv8tion.jda.core.entities.IMentionable IMentionable} instances - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} - * @throws IllegalArgumentException If provided with {@code null} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * @throws IllegalArgumentException If provided with {@code null} * @since 3.4.0 */ public List getMentions(Message.MentionType... types) { @@ -488,20 +472,18 @@ public List getMentions(Message.MentionType... types) { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#isMentioned} - *

+ * *

Checks if given {@link net.dv8tion.jda.core.entities.IMentionable IMentionable} was mentioned in this message * in any way (@User, @everyone, @here, @Role).
If no filtering {@link net.dv8tion.jda.core.entities.Message * .MentionType MentionTypes} are specified this will fallback to all mention types. * * @param mentionable The mentionable entity to check on. - * @param types The types to include when checking whether this type was mentioned. This will be used with - * {@link #getMentions(net.dv8tion.jda.core.entities.Message.MentionType...) - * getMentions(MentionType...)} - * + * @param types The types to include when checking whether this type was mentioned. This will be used with + * {@link #getMentions(net.dv8tion.jda.core.entities.Message.MentionType...) + * getMentions(MentionType...)} * @return True, if the given mentionable was mentioned in this message - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public boolean isMentioned(IMentionable mentionable, Message.MentionType... types) { return getMessage().isMentioned(mentionable, types); @@ -509,7 +491,7 @@ public boolean isMentioned(IMentionable mentionable, Message.MentionType... type /** * Copied From {@link net.dv8tion.jda.core.entities.Message#mentionsEveryone} - *

+ * *

Indicates if this Message mentions everyone using @everyone or @here. * * @return True, if message is mentioning everyone @@ -520,7 +502,7 @@ public boolean mentionsEveryone() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#isEdited} - *

+ * *

Returns whether or not this Message has been edited before. * * @return True if this message has been edited. @@ -531,7 +513,7 @@ public boolean isEdited() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getEditedTime} - *

+ * *

Provides the {@link java.time.OffsetDateTime OffsetDateTime} defining when this Message was last edited. If * this Message has not been edited ({@link #isEdited()} is {@code false}), then this method will return {@code * null}. @@ -544,13 +526,13 @@ public OffsetDateTime getEditedTime() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getInvites} - *

+ * *

Creates an immutable List of {@link net.dv8tion.jda.core.entities.Invite Invite} codes that are included in * this Message.
This will use the {@link java.util.regex.Pattern Pattern} provided under {@link * net.dv8tion.jda.core.entities.Message#INVITE_PATTERN} to construct a {@link java.util.regex.Matcher Matcher} that * will parse the {@link net.dv8tion.jda.core.entities.Message#getContentRaw()} output and include all codes it * finds in a list. - *

+ * *

You can use the codes to retrieve/validate invites via {@link net.dv8tion.jda.core.entities.Invite#resolve * (net.dv8tion.jda.core.JDA, String) Invite.resolve(JDA, String)} * @@ -562,14 +544,13 @@ public List getInvites() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getNonce} - *

+ * *

Validation nonce for this * Message
This can be used to validate that a Message was properly sent to the Discord Service.
To set a * nonce before sending you may use {@link net.dv8tion.jda.core.MessageBuilder#setNonce(String) * MessageBuilder.setNonce(String)}! * * @return The validation nonce - * * @see net.dv8tion.jda.core.MessageBuilder#setNonce(String) * @see Cryptographic Nonce - * Wikipedia @@ -581,21 +562,19 @@ public String getNonce() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#isFromType} - *

+ * *

Used to determine if this Message was received from a {@link net.dv8tion.jda.core.entities.MessageChannel * MessageChannel} of the {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} specified.
This will * always be false for {@link net.dv8tion.jda.core.entities.ChannelType#VOICE} as Messages can't be sent to {@link * net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}. - *

+ * *

Useful for restricting functionality to a certain type of channels. * * @param type The {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} to check against. - * * @return True if the {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} which this message was received * from is the same as the one specified by {@code type}. - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public boolean isFromType(ChannelType type) { return getMessage().isFromType(type); @@ -603,15 +582,14 @@ public boolean isFromType(ChannelType type) { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getChannelType} - *

+ * *

Gets the {@link net.dv8tion.jda.core.entities.ChannelType ChannelType} that this message was received from. *
This will never be {@link net.dv8tion.jda.core.entities.ChannelType#VOICE} as Messages can't be sent to * {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}. * * @return The ChannelType which this message was received from. - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public ChannelType getChannelType() { return getMessage().getChannelType(); @@ -619,20 +597,19 @@ public ChannelType getChannelType() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getPrivateChannel} - *

+ * *

Returns the {@link net.dv8tion.jda.core.entities.PrivateChannel PrivateChannel} that this message was sent * in.
This is only valid if the Message was actually sent in a PrivateChannel. This will return {@code * null} if it was not sent from a PrivateChannel.
You can check the type of channel this message was sent from * using {@link #isFromType(net.dv8tion.jda.core.entities.ChannelType)} or {@link #getChannelType()}. - *

+ * *

Use {@link #getChannel()} for an ambiguous {@link net.dv8tion.jda.core.entities.MessageChannel MessageChannel} * if you do not need functionality specific to {@link net.dv8tion.jda.core.entities.PrivateChannel * PrivateChannel}. * * @return The PrivateChannel this message was sent in, or {@code null} if it was not sent from a PrivateChannel. - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public PrivateChannel getPrivateChannel() { return getMessage().getPrivateChannel(); @@ -640,19 +617,18 @@ public PrivateChannel getPrivateChannel() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getGroup} - *

+ * *

Returns the {@link net.dv8tion.jda.client.entities.Group Group} that this message was sent in.
This is * only valid if the Message was actually sent in a Group. This will return {@code null} if it was not sent from * a Group.
You can check the type of channel this message was sent from using {@link * #isFromType(net.dv8tion.jda.core.entities.ChannelType)} or {@link #getChannelType()}. - *

+ * *

Use {@link #getChannel()} for an ambiguous {@link net.dv8tion.jda.core.entities.MessageChannel MessageChannel} * if you do not need functionality specific to {@link net.dv8tion.jda.client.entities.Group Group}. * * @return The Group this message was sent in, or {@code null} if it was not sent from a Group. - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public Group getGroup() { return getMessage().getGroup(); @@ -660,19 +636,18 @@ public Group getGroup() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getTextChannel} - *

+ * *

Returns the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} that this message was sent in. *
This is only valid if the Message was actually sent in a TextChannel. This will return {@code null} if * it was not sent from a TextChannel.
You can check the type of channel this message was sent from using {@link * #isFromType(net.dv8tion.jda.core.entities.ChannelType)} or {@link #getChannelType()}. - *

+ * *

Use {@link #getChannel()} for an ambiguous {@link net.dv8tion.jda.core.entities.MessageChannel MessageChannel} * if you do not need functionality specific to {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}. * * @return The TextChannel this message was sent in, or {@code null} if it was not sent from a TextChannel. - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public TextChannel getTextChannel() { return getMessage().getTextChannel(); @@ -680,14 +655,13 @@ public TextChannel getTextChannel() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getCategory} - *

+ * *

The {@link net.dv8tion.jda.core.entities.Category Category} this message was sent in. This will always be * {@code null} for DMs and Groups.
Equivalent to {@code getTextChannel().getParent()}. * * @return {@link net.dv8tion.jda.core.entities.Category Category} for this message - * * @throws UnsupportedOperationException If this is not a Received Message from {@link net.dv8tion.jda.core - * .entities.MessageType#DEFAULT MessageType.DEFAULT} + * .entities.MessageType#DEFAULT MessageType.DEFAULT} */ public Category getCategory() { return getMessage().getCategory(); @@ -695,7 +669,7 @@ public Category getCategory() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getAttachments} - *

+ * *

An unmodifiable list of {@link net.dv8tion.jda.core.entities.Message.Attachment Attachments} that are * attached to this message.
Most likely this will only ever be 1 {@link net.dv8tion.jda.core.entities * .Message.Attachment Attachment} at most. @@ -708,7 +682,7 @@ public List getAttachments() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#isTTS} - *

+ * *

Defines whether or not this Message triggers TTS (Text-To-Speech). * * @return If this message is TTS. @@ -719,7 +693,7 @@ public boolean isTTS() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#isPinned} - *

+ * *

Whether or not this Message has been pinned in its parent channel. * * @return True - if this message has been pinned. @@ -729,45 +703,38 @@ public boolean isPinned() { } /** - * Copied From {@link net.dv8tion.jda.core.entities.Message#pin} - *

- *

Used to add the Message to the {@link net.dv8tion.jda.core.entities.Message#getChannel() MessageChannel's} - * pinned message list.
This is a shortcut method to - * {@link net.dv8tion.jda.core.entities.MessageChannel#pinMessageById(String)}. - *

+ * Used to add the Message to the {@link #getChannel() MessageChannel's} pinned message list. + *
This is a shortcut method to {@link net.dv8tion.jda.core.entities.MessageChannel#pinMessageById(String)}. + * *

The success or failure of this action will not affect the return of {@link #isPinned()}. - *

- *

The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:

  • {@link - * net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
    The pin request was attempted - * after the account lost access to the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} due to {@link - * net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} being revoked, or the account lost access - * to the {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} - * typically due to being kicked or removed.
  • - *

    - *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS}
    The pin - * request was attempted after the account lost {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE - * Permission.MESSAGE_MANAGE} in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.
  • - *

    - *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} The pin request was - * attempted after the Message had been deleted.
* - * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link Void} + *

The following {@link ErrorResponse ErrorResponses} are possible: + *

    + *
  • {@link ErrorResponse#MISSING_ACCESS MISSING_ACCESS} + *
    The pin request was attempted after the account lost access to the {@link TextChannel TextChannel} + * due to {@link Permission#MESSAGE_READ Permission.MESSAGE_READ} being revoked, or the + * account lost access to the {@link Guild Guild} or {@link Group Group} + * typically due to being kicked or removed.
  • * - * @throws UnsupportedOperationException If this is not a Received Message from - * {@link net.dv8tion.jda.core.entities - * .MessageType#DEFAULT MessageType.DEFAULT} - * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If this Message is from a {@link - * net.dv8tion.jda.core.entities.TextChannel - * TextChannel} and:
    • Missing - * {@link net.dv8tion.jda.core - * .Permission#MESSAGE_READ - * Permission.MESSAGE_READ}.
      The account - * needs access the the channel to pin a - * message in it.
    • Missing {@link - * net.dv8tion.jda.core - * .Permission#MESSAGE_MANAGE - * Permission.MESSAGE_MANAGE}.
      Required - * to actually pin the Message.
    + *
  • {@link ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The pin request was attempted after the account lost + * {@link Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in + * the {@link TextChannel TextChannel}.
  • + * + *
  • {@link ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} + * The pin request was attempted after the Message had been deleted.
  • + *
+ * + * @return {@link RestAction RestAction} - Type: {@link Void} + * @throws UnsupportedOperationException If this is not a Received Message from {@link MessageType#DEFAULT + * MessageType.DEFAULT} + * @throws InsufficientPermissionException If this Message is from a {@link TextChannel TextChannel} and: + *
    + *
  • Missing {@link Permission#MESSAGE_READ Permission.MESSAGE_READ}. + *
    The account needs access the the channel to pin a message in it.
  • + *
  • Missing {@link Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE}. + *
    Required to actually pin the Message.
  • + *
*/ @CheckReturnValue public RestAction pin() { @@ -776,44 +743,42 @@ public RestAction pin() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#unpin} - *

+ * *

Used to remove the Message from the {@link net.dv8tion.jda.core.entities.Message#getChannel() * MessageChannel's} pinned message list.
This is a shortcut method to {@link * net.dv8tion.jda.core.entities.MessageChannel#unpinMessageById(String)}. - *

+ * *

The success or failure of this action will not affect the return of {@link #isPinned()}. - *

+ * *

The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:

  • {@link * net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
    The unpin request was attempted * after the account lost access to the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} due to {@link * net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} being revoked, or the account lost access * to the {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} * typically due to being kicked or removed.
  • - *

    - *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS}
    The unpin - * request was attempted after the account lost {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE - * Permission.MESSAGE_MANAGE} in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.
  • - *

    + * + *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS + * MISSING_PERMISSIONS} + *
    The unpin request was attempted after the account lost + * {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} + * in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.
  • + * *
  • {@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} The unpin request was * attempted after the Message had been deleted.
* * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link Void} - * - * @throws UnsupportedOperationException If this is not a Received Message from - * {@link net.dv8tion.jda.core.entities - * .MessageType#DEFAULT MessageType.DEFAULT} + * @throws UnsupportedOperationException If this is not a Received Message from + * {@link net.dv8tion.jda.core.entities + * .MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If this Message is from a {@link - * net.dv8tion.jda.core.entities.TextChannel - * TextChannel} and:
  • Missing - * {@link net.dv8tion.jda.core - * .Permission#MESSAGE_READ - * Permission.MESSAGE_READ}.
    The account - * needs access the the channel to pin a - * message in it.
  • Missing {@link - * net.dv8tion.jda.core - * .Permission#MESSAGE_MANAGE - * Permission.MESSAGE_MANAGE}.
    Required - * to actually pin the Message.
+ * net.dv8tion.jda.core.entities.TextChannel TextChannel} and:
  • Missing + * {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ}.
    The account + * needs access the the channel to pin a + * message in it.
  • Missing {@link + * net.dv8tion.jda.core + * .Permission#MESSAGE_MANAGE + * Permission.MESSAGE_MANAGE}.
    Required + * to actually pin the Message.
*/ @CheckReturnValue public RestAction unpin() { @@ -822,44 +787,45 @@ public RestAction unpin() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#clearReactions} - *

+ * *

Removes all reactions from this Message.
This is useful for moderator commands that wish to remove all * reactions at once from a specific message. - *

+ * *

Neither success nor failure of this request will affect this Message's {@link * net.dv8tion.jda.core.entities.Message#getReactions()} return as Message is immutable. - *

+ * *

The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:

  • {@link * net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
    The clear-reactions request was * attempted after the account lost access to the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} due * to {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} being revoked, or the account * lost access to the {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link * net.dv8tion.jda.client.entities.Group Group} typically due to being kicked or removed.
  • - *

    - *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS}
    The - * clear-reactions request was attempted after the account lost {@link net.dv8tion.jda.core - * .Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the {@link net.dv8tion.jda.core.entities.TextChannel - * TextChannel} when adding the reaction.
  • - *

    + * + *

  • {@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS + * MISSING_PERMISSIONS} + *
    The clear-reactions request was attempted after the account lost + * {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} + * in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} + * when adding the reaction.
  • + * *
  • {@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} The clear-reactions * request was attempted after the Message had been deleted.
* * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link Void} - * - * @throws UnsupportedOperationException If this is not a Received Message from - * {@link net.dv8tion.jda.core.entities - * .MessageType#DEFAULT MessageType.DEFAULT} + * @throws UnsupportedOperationException If this is not a Received Message from + * {@link net.dv8tion.jda.core.entities + * .MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If the MessageChannel this message was - * sent in was a {@link net.dv8tion.jda - * .core.entities.TextChannel TextChannel} - * and the currently logged in account does - * not have {@link net.dv8tion.jda.core - * .Permission#MESSAGE_MANAGE Permission - * .MESSAGE_MANAGE} - * in the channel. - * @throws IllegalStateException If this message was not sent in a - * {@link net.dv8tion.jda.core.entities - * .TextChannel TextChannel}. + * sent in was a {@link net.dv8tion.jda + * .core.entities.TextChannel TextChannel} + * and the currently logged in account does + * not have {@link net.dv8tion.jda.core + * .Permission#MESSAGE_MANAGE Permission + * .MESSAGE_MANAGE} + * in the channel. + * @throws IllegalStateException If this message was not sent in a + * {@link net.dv8tion.jda.core.entities + * .TextChannel TextChannel}. */ @CheckReturnValue public RestAction clearReactions() { @@ -868,9 +834,9 @@ public RestAction clearReactions() { /** * Copied From {@link net.dv8tion.jda.core.entities.Message#getType} - *

+ * *

This specifies the {@link net.dv8tion.jda.core.entities.MessageType MessageType} of this Message. - *

+ * *

Messages can represent more than just simple text sent by Users, they can also be special messages that inform * about events occurs. A few examples are the system message informing that a message has been pinned. Another * would be the system message informing that a call has been started or ended in a group. @@ -883,12 +849,11 @@ public MessageType getType() { /** * Copied From {@link net.dv8tion.jda.core.entities.ISnowflake#getCreationTime} - *

+ * *

The time this entity was created. Calculated through the Snowflake in {@link * net.dv8tion.jda.core.entities.ISnowflake#getIdLong}. * * @return OffsetDateTime - Time this entity was created at. - * * @see net.dv8tion.jda.core.utils.MiscUtil#getCreationTime(long) */ public OffsetDateTime getCreationTime() { diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java index 0a3706e4..a560cbff 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/parameter/CommandArgument.java @@ -33,7 +33,9 @@ import java.util.stream.IntStream; /** - * This represents a space separated argument in a Command. Mentions are eagerly evaluated while everything else is lazily evaluated. Methods begging in {@code parse} do not store the return value and as such, each call parses the content again. + * This represents a space separated argument in a Command. Mentions are eagerly evaluated while everything else is + * lazily evaluated. Methods begging in {@code parse} do not store the return value and as such, each call parses the + * content again. */ public interface CommandArgument { @@ -61,7 +63,8 @@ default BreadBot getClient() { } /** - * If this method returns {@code true}, that means this argument has been eagerly evaluated to a mention. This argument would be of type + * If this method returns {@code true}, that means this argument has been eagerly evaluated to a mention. This + * argument would be of type *

    *
  • User Mention
  • *
  • Member Mention
  • @@ -77,25 +80,27 @@ default boolean isMention() { return false; } - /** - * Grabs the corresponding parser from the BreadBotClient and attempts to parse this argument to the passed type. If successful, return the result. + * Grabs the corresponding parser from the BreadBotClient and attempts to parse this argument to the passed type. If + * successful, return the result. * * @param type the class of the type - * @param The type + * @param The type * @return the result if can be parsed, otherwise {@code null}. */ default T getAsType(Class type) { TypeParser parser = getClient().getArgumentTypes().getTypeParser(type); if (parser != null) return parser.parse(this); - else return null; + else + return null; } /** * Invocation is exactly the same as: *
    
    -     *     this.{@link CommandArgument#getArgument() getArgument()}.{@link java.lang.String#matches(String) matches}(regex)
    +     *     this.{@link CommandArgument#getArgument() getArgument()}.{@link java.lang.String#matches(String)
    +     * matches}(regex)
          * 
    * * @param regex the regular expression to which this string is to be matched @@ -109,12 +114,14 @@ default boolean matches(String regex) { /** * Invocation is exactly the same as: *
    
    -     *     this.{@link CommandArgument#getArgument() getArgument()}.{@link java.lang.String#matches(String) matches}(regex)
    +     *     this.{@link CommandArgument#getArgument() getArgument()}.{@link java.lang.String#matches(String)
    +     * matches}(regex)
          * 
    * * @param regex the regular expression to which this string is to be matched - * @return {@code true} if, and only if, this string matches the - * given regular expression + * @param flags any match flags. See {@link Pattern#compile(String, int)} + * @return {@code true} if, and only if, this string matches the given regular expression + * @see Pattern#compile(String, int) */ default boolean matches(String regex, int flags) { return Pattern.compile(regex, flags).matcher(getArgument()).matches(); @@ -123,7 +130,8 @@ default boolean matches(String regex, int flags) { /** * Invocation is exactly the same as: *
    
    -     *     pattern.{@link Pattern#matcher(java.lang.CharSequence) matcher}(this.{@link CommandArgument#getArgument() getArgument()}).{@link java.util.regex.Matcher#matches() matches()}
    +     *     pattern.{@link Pattern#matcher(java.lang.CharSequence) matcher}(this.{@link CommandArgument#getArgument()
    +     * getArgument()}).{@link java.util.regex.Matcher#matches() matches()}
          * 
    * * @param pattern the regex Pattern to match the argument with. @@ -135,22 +143,27 @@ default boolean matches(Pattern pattern) { } /** - * Checks whether the underlying string consists of only digits with an exception of {@code -} or {@code +} at the beginning. + * Checks whether the underlying string consists of only digits with an exception of {@code -} or {@code +} at the + * beginning. *

    Result is equivalent to a regex of: *

    
          *     [-+]?[0-9]+
          * 
    * - * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} or {@code +} + * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} + * or {@code +} */ default boolean isNumeric() { return Arguments.isNumber(getArgument()); } /** - * Equivalent to {@link CommandArgument#isNumeric isNumeric()} but also checks that the number is within the range of an integer + * Equivalent to {@link CommandArgument#isNumeric isNumeric()} but also checks that the number is within the range + * of an integer * - * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} or {@code +} and the number does not exceed {@link java.lang.Integer#MAX_VALUE} or {@link java.lang.Integer#MIN_VALUE} + * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} + * or {@code +} and the number does not exceed {@link java.lang.Integer#MAX_VALUE} or {@link + * java.lang.Integer#MIN_VALUE} */ default boolean isInteger() { return Arguments.isInteger(getArgument()); @@ -167,9 +180,11 @@ default int parseInt() { } /** - * Equivalent to {@link CommandArgument#isNumeric isNumeric()} but also checks that the number is within the range of an integer + * Equivalent to {@link CommandArgument#isNumeric isNumeric()} but also checks that the number is within the range + * of an integer * - * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} or {@code +} and the number does not exceed {@link java.lang.Long#MAX_VALUE} or {@link java.lang.Long#MIN_VALUE} + * @return {@code true} if and only if this argument only contains {@code 0-9} with an optional prefix of {@code -} + * or {@code +} and the number does not exceed {@link java.lang.Long#MAX_VALUE} or {@link java.lang.Long#MIN_VALUE} */ default boolean isLong() { return Arguments.isLong(getArgument()); @@ -187,6 +202,9 @@ default long parseLong() { /** * Checks the expression against the regex provided in {@link java.lang.Double#valueOf(String)} + * + * @return {@code true} if this argument can be parsed to a Float or Double + * @see Double#parseDouble(String) */ default boolean isFloat() { return Arguments.isFloat(getArgument()); @@ -229,18 +247,24 @@ default boolean isRange() { } /** - * Parses this argument as an inclusive range and returns an {@link java.util.stream.IntStream} consisting of the elements in the stream in the order declared - *

    For example, an argument of {@code "2-6"} will return a stream of {@code [2,3,4,5,6]} and an argument of {@code "8-5"} will return a stream of {@code [8,7,6,5]}. - *

    This method CAN be used in cases where {@link CommandArgument#isRange isRange()} would return false. If the argument is a single integer, where {@link CommandArgument#isInteger isInteger()} would return {@code true}, an {@link java.util.stream.IntStream} with a single value will be returned. + * Parses this argument as an inclusive range and returns an {@link java.util.stream.IntStream} consisting of the + * elements in the stream in the order declared + *

    For example, an argument of {@code "2-6"} will return a stream of {@code [2,3,4,5,6]} and an argument of + * {@code "8-5"} will return a stream of {@code [8,7,6,5]}. + *

    This method CAN be used in cases where {@link CommandArgument#isRange isRange()} would return false. If + * the argument is a single integer, where {@link CommandArgument#isInteger isInteger()} would return {@code true}, + * an {@link java.util.stream.IntStream} with a single value will be returned. * - * @return an ordered {@link java.util.stream.IntStream}. If {@link CommandArgument#isRange isRange()} AND {@link CommandArgument#isInteger isInteger()} would return false, {@code null} will be returned. + * @return an ordered {@link java.util.stream.IntStream}. If {@link CommandArgument#isRange isRange()} AND {@link + * CommandArgument#isInteger isInteger()} would return false, {@code null} will be returned. */ default IntStream parseRange() { return Arguments.parseRange(getArgument()); } /** - * Checks if this matches a hexadecimal number, specifically whether this argument consists of digits 0-10 and/or letters a-f optionally prefixed by {@code #} or {@code 0x} + * Checks if this matches a hexadecimal number, specifically whether this argument consists of digits 0-10 and/or + * letters a-f optionally prefixed by {@code #} or {@code 0x} * The result of this method is equivalent to checking this argument against a regex of {@code (#|0x)?[0-9a-fA-F]+} * * @return {@code true} if it matches the format required. @@ -284,14 +308,19 @@ default boolean parseBoolean() { boolean isUser(); /** - * Checks if this argument is a {@link net.dv8tion.jda.core.entities.User} mention that can be correctly resolved to a {@link net.dv8tion.jda.core.entities.User}. - * The result of this method is equivalent to checking this argument against a regex of {@code <@(!)?[0-9]+>} and then checking to see if {@link net.dv8tion.jda.core.JDA} has knowledge of a {@link net.dv8tion.jda.core.entities.User} with that id. + * Checks if this argument is a {@link net.dv8tion.jda.core.entities.User} mention that can be correctly resolved to + * a {@link net.dv8tion.jda.core.entities.User}. + * The result of this method is equivalent to checking this argument against a regex of {@code <@(!)?[0-9]+>} and + * then checking to see if {@link net.dv8tion.jda.core.JDA} has knowledge of a {@link + * net.dv8tion.jda.core.entities.User} with that id. *

    * If this method returns {@code false} and {@link CommandArgument#isUser} returns {@code true}, this * CommandArgument is can be cast to an - * {@link com.github.breadmoirai.breadbot.framework.event.internal.arguments.InvalidMentionArgument InvalidMentionArgument} + * {@link com.github.breadmoirai.breadbot.framework.event.internal.arguments.InvalidMentionArgument + * InvalidMentionArgument} * - * @return {@code true} if this is a formatted {@link net.dv8tion.jda.core.entities.User} mention that can be resolved to an entity. + * @return {@code true} if this is a formatted {@link net.dv8tion.jda.core.entities.User} mention that can be + * resolved to an entity. */ boolean isValidUser(); @@ -314,7 +343,8 @@ default User getUser() { * {@link net.dv8tion.jda.core.entities.Guild} to see if it is a * {@link net.dv8tion.jda.core.entities.Member}. * - * @return {@code true} if the {@link net.dv8tion.jda.core.entities.Member} can be resolved to a valid JDA entity. Otherwise {@code false} + * @return {@code true} if the {@link net.dv8tion.jda.core.entities.Member} can be resolved to a valid JDA entity. + * Otherwise {@code false} */ boolean isValidMember(); @@ -331,20 +361,24 @@ default Member getMember() { /** * Searches for a member in the {@link net.dv8tion.jda.core.entities.Guild} using the argument as criteria. - * If it matches multiple users, the user whose name begins with the argument is given precedence. If multiple users match, the first one found is returned. + * If it matches multiple users, the user whose name begins with the argument is given precedence. If multiple users + * match, the first one found is returned. * This attempts to match Username and Nickname. - *

    - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Member} mention, that {@link net.dv8tion.jda.core.entities.Member} is returned within the {@link java.util.Optional}. * - * @return the first {@link net.dv8tion.jda.core.entities.Member} found, otherwise an empty {@link java.util.Optional} + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Member} mention, that {@link + * net.dv8tion.jda.core.entities.Member} is returned within the {@link java.util.Optional}. + * + * @return the first {@link net.dv8tion.jda.core.entities.Member} found, otherwise an empty + * {@link java.util.Optional} */ Optional findMember(); /** * Searches for members whose Username or Nickname contains this argument. - *

    - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Member} mention, a {@link java.util.List} with only that element is returned. + * + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Member} mention, a {@link + * java.util.List} with only that element is returned. * * @return A never-null {@link java.util.List} of {@link net.dv8tion.jda.core.entities.Member Members} */ @@ -361,17 +395,23 @@ default Member getMember() { /** * Checks if this argument is a {@link net.dv8tion.jda.core.entities.Role} mention. - * The result of this method is equivalent to checking this argument against a regex of {@code <@&[0-9]+>} and checking if it can be correctly resolved to a {@link net.dv8tion.jda.core.entities.Role} within the {@link net.dv8tion.jda.core.entities.Guild}. + * The result of this method is equivalent to checking this argument against a regex of {@code <@&[0-9]+>} and + * checking if it can be correctly resolved to a {@link net.dv8tion.jda.core.entities.Role} within the {@link + * net.dv8tion.jda.core.entities.Guild}. * - * @return {@code true} if this is a valid {@link net.dv8tion.jda.core.entities.Role} mention that can be resolved to a valid JDA entity. + * @return {@code true} if this is a valid {@link net.dv8tion.jda.core.entities.Role} mention that can be resolved + * to a valid JDA entity. */ boolean isValidRole(); /** - * Attempts to resolve this argument to a {@link net.dv8tion.jda.core.entities.Role} in the {@link net.dv8tion.jda.core.entities.Guild}. - * If {@link CommandArgument#isRole isRole()} would return true, it is guaranteed that this method returns a {@code non-null} value. + * Attempts to resolve this argument to a {@link net.dv8tion.jda.core.entities.Role} in the {@link + * net.dv8tion.jda.core.entities.Guild}. + * If {@link CommandArgument#isRole isRole()} would return true, it is guaranteed that this method returns a {@code + * non-null} value. * - * @return {@link net.dv8tion.jda.core.entities.Role} if role is present within the {@link net.dv8tion.jda.core.entities.Guild}, otherwise {@code null} + * @return {@link net.dv8tion.jda.core.entities.Role} if role is present within the {@link + * net.dv8tion.jda.core.entities.Guild}, otherwise {@code null} * @throws UnsupportedOperationException if {@link CommandArgument#isValidRole()} would return {@code false} */ default Role getRole() { @@ -380,17 +420,20 @@ default Role getRole() { /** * Attempts to match this argument to a {@link net.dv8tion.jda.core.entities.Role} by name. - *

    - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Role} mention, that {@link net.dv8tion.jda.core.entities.Role} is returned within the {@link java.util.Optional}. + * + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Role} mention, that {@link + * net.dv8tion.jda.core.entities.Role} is returned within the {@link java.util.Optional}. * * @return the first {@link net.dv8tion.jda.core.entities.Role} found, otherwise an empty {@link java.util.Optional} */ Optional findRole(); /** - * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.Role Roles} that match this argument. The criteria being that the {@link net.dv8tion.jda.core.entities.Role} name should contain this argument. - *

    - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Role} mention, a {@link java.util.List} with only that element is returned. + * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.Role Roles} that match this argument. + * The criteria being that the {@link net.dv8tion.jda.core.entities.Role} name should contain this argument. + * + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.Role} mention, a {@link + * java.util.List} with only that element is returned. * * @return A never-null {@link java.util.List} of {@link net.dv8tion.jda.core.entities.Role Roles}. */ @@ -405,21 +448,28 @@ default Role getRole() { boolean isTextChannel(); /** - * Checks if this argument is a {@link net.dv8tion.jda.core.entities.TextChannel} mention that can be correctly resolved to a {@link net.dv8tion.jda.core.entities.TextChannel}. - * The result of this method is equivalent to checking this argument against a regex of {@code <#[0-9]+>} and then checking to see if {@link net.dv8tion.jda.core.JDA} has knowledge of a {@link net.dv8tion.jda.core.entities.TextChannel} with that id. + * Checks if this argument is a {@link net.dv8tion.jda.core.entities.TextChannel} mention that can be correctly + * resolved to a {@link net.dv8tion.jda.core.entities.TextChannel}. + * The result of this method is equivalent to checking this argument against a regex of {@code <#[0-9]+>} and then + * checking to see if {@link net.dv8tion.jda.core.JDA} has knowledge of a {@link + * net.dv8tion.jda.core.entities.TextChannel} with that id. *

    * If this method returns {@code false} and {@link CommandArgument#isTextChannel()} returns {@code true}, this * CommandArgument is can be cast to an - * {@link com.github.breadmoirai.breadbot.framework.event.internal.arguments.InvalidMentionArgument InvalidMentionArgument} + * {@link com.github.breadmoirai.breadbot.framework.event.internal.arguments.InvalidMentionArgument + * InvalidMentionArgument} * - * @return {@code true} if this is a formatted {@link net.dv8tion.jda.core.entities.TextChannel} mention and can be correctly resolved to a JDA entity. + * @return {@code true} if this is a formatted {@link net.dv8tion.jda.core.entities.TextChannel} mention and can be + * correctly resolved to a JDA entity. */ boolean isValidTextChannel(); /** - * Attempts to resolve this argument as a {@link net.dv8tion.jda.core.entities.TextChannel} mention to a {@link net.dv8tion.jda.core.entities.TextChannel} in the {@link net.dv8tion.jda.core.entities.Guild}. - *

    - *

    If {@link CommandArgument#isTextChannel isTextChannel()} would return true, it is guaranteed that this method returns a {@code non-null} value. + * Attempts to resolve this argument as a {@link net.dv8tion.jda.core.entities.TextChannel} mention to a {@link + * net.dv8tion.jda.core.entities.TextChannel} in the {@link net.dv8tion.jda.core.entities.Guild}. + * + *

    If {@link CommandArgument#isTextChannel isTextChannel()} would return true, it is guaranteed that this method + * returns a {@code non-null} value. * * @return {@link net.dv8tion.jda.core.entities.TextChannel} if can be resolved to a JDA entity * @throws UnsupportedOperationException if {@link CommandArgument#isValidTextChannel()} would return {@code false} @@ -430,16 +480,21 @@ default TextChannel getTextChannel() { /** * Attempts to match this argument to a {@link net.dv8tion.jda.core.entities.TextChannel} by name. - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.TextChannel} mention, that {@link net.dv8tion.jda.core.entities.TextChannel} is returned within the {@link java.util.Optional}. + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.TextChannel} mention, that {@link + * net.dv8tion.jda.core.entities.TextChannel} is returned within the {@link java.util.Optional}. * - * @return the first {@link net.dv8tion.jda.core.entities.TextChannel} found, otherwise an empty {@link java.util.Optional} + * @return the first {@link net.dv8tion.jda.core.entities.TextChannel} found, otherwise an empty + * {@link java.util.Optional} */ Optional findTextChannel(); /** - * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.TextChannel TextChannels} that match this argument. The criteria being that the {@link net.dv8tion.jda.core.entities.TextChannel} name should contain this argument. - *

    - *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.TextChannel} mention, a {@link java.util.List} with only that element is returned. + * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.TextChannel TextChannels} that match + * this argument. The criteria being that the {@link net.dv8tion.jda.core.entities.TextChannel} name should contain + * this argument. + * + *

    If this argument is already a valid {@link net.dv8tion.jda.core.entities.TextChannel} mention, a {@link + * java.util.List} with only that element is returned. * * @return A never-null {@link java.util.List} of {@link net.dv8tion.jda.core.entities.TextChannel TextChannels}. */ @@ -448,12 +503,15 @@ default TextChannel getTextChannel() { /** * Attempts to match this argument to a {@link net.dv8tion.jda.core.entities.VoiceChannel} by name. * - * @return the first {@link net.dv8tion.jda.core.entities.VoiceChannel} if found, otherwise an empty {@link java.util.Optional} + * @return the first {@link net.dv8tion.jda.core.entities.VoiceChannel} if found, otherwise an empty {@link + * java.util.Optional} */ Optional findVoiceChannel(); /** - * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.VoiceChannel Roles} that match this argument. The criteria being that the {@link net.dv8tion.jda.core.entities.VoiceChannel} name should contain this argument. + * Returns a {@link java.util.List} of {@link net.dv8tion.jda.core.entities.VoiceChannel Roles} that match this + * argument. The criteria being that the {@link net.dv8tion.jda.core.entities.VoiceChannel} name should contain this + * argument. * * @return A never-null {@link java.util.List} of {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}. */ @@ -468,11 +526,15 @@ default TextChannel getTextChannel() { boolean isEmote(); /** - * If {@link #isEmote()} would return {@code true}, this method will always return a {@code not-null} value, {@code null} otherwise. - * If the formatting is correct but {@link net.dv8tion.jda.core.JDA} cannot resolve the {@link net.dv8tion.jda.core.entities.Emote}, - * a {@link net.dv8tion.jda.core.entities.IFakeable Fake} {@link net.dv8tion.jda.core.entities.Emote} will be returned. - *

    - *

    If {@link CommandArgument#isEmote isEmote()} would return true, it is guaranteed that this method returns a {@code non-null} value. + * If {@link #isEmote()} would return {@code true}, this method will always return a {@code not-null} value, {@code + * null} otherwise. + * If the formatting is correct but {@link net.dv8tion.jda.core.JDA} cannot resolve the {@link + * net.dv8tion.jda.core.entities.Emote}, + * a {@link net.dv8tion.jda.core.entities.IFakeable Fake} {@link net.dv8tion.jda.core.entities.Emote} will be + * returned. + * + *

    If {@link CommandArgument#isEmote isEmote()} would return true, it is guaranteed that this method returns a + * {@code non-null} value. * * @return An {@link net.dv8tion.jda.core.entities.Emote} if the formatting is correct. Otherwise {@code null}. * @throws UnsupportedOperationException if {@link CommandArgument#isEmote()} would return {@code false} @@ -482,7 +544,9 @@ default Emote getEmote() { } /** - * Will attempt to match this argument against the emojis found in {@link com.github.breadmoirai.breadbot.util.Emoji} using their unicode value. + * Will attempt to match this argument against the emojis found in + * {@link com.github.breadmoirai.breadbot.util.Emoji} + * using their unicode value. * The implementation of this method is *

    
          *     return {@link CommandArgument#getEmoji}() != null
    @@ -493,7 +557,8 @@ default Emote getEmote() {
         boolean isEmoji();
     
         /**
    -     * Attempts to find a matching {@link com.github.breadmoirai.breadbot.util.Emoji} with {@link com.github.breadmoirai.breadbot.util.Emoji#find(String)}
    +     * Attempts to find a matching {@link com.github.breadmoirai.breadbot.util.Emoji} with {@link
    +     * com.github.breadmoirai.breadbot.util.Emoji#find(String)}
          *
          * @return The {@link com.github.breadmoirai.breadbot.util.Emoji} if matched.
          * @throws UnsupportedOperationException if {@link CommandArgument#isEmoji()} would return {@code false}
    diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/response/RestActionExtension.java b/src/main/java/com/github/breadmoirai/breadbot/framework/response/RestActionExtension.java
    index b15128d5..8f04768d 100644
    --- a/src/main/java/com/github/breadmoirai/breadbot/framework/response/RestActionExtension.java
    +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/response/RestActionExtension.java
    @@ -38,7 +38,7 @@ public interface RestActionExtension {
     
         /**
          * Sets a Consumer that will be called on the failure of this action.
    -     * 

    + * *

    By default this will simply log and ignore the exception * * @param failure a consumer that accepts a throwable diff --git a/src/main/java/com/github/breadmoirai/breadbot/framework/response/internal/CommandResponseMessage.java b/src/main/java/com/github/breadmoirai/breadbot/framework/response/internal/CommandResponseMessage.java index 39e7f8e7..7d67de55 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/framework/response/internal/CommandResponseMessage.java +++ b/src/main/java/com/github/breadmoirai/breadbot/framework/response/internal/CommandResponseMessage.java @@ -442,7 +442,7 @@ public RMessageBuilder append(CharSequence text, net.dv8tion.jda.core.MessageBui *
    Messages by default output their {@link net.dv8tion.jda.core.entities.Message#getContentDisplay() getContentDisplay()} value and * as alternative use the {@link net.dv8tion.jda.core.entities.Message#getContentRaw() getContentRaw()} value *

- *

+ * *

Example: *
If you placed the following code in an method handling a * {@link net.dv8tion.jda.core.events.message.MessageReceivedEvent MessageReceivedEvent} @@ -613,7 +613,7 @@ public REmbedBuilder appendFailure(Consumer failure) { /** * Sets the Title of the embed. *
Overload for {@link #title(String, String)} without URL parameter. - *

+ * *

Example * * @param title the title of the embed @@ -631,7 +631,7 @@ public REmbedBuilder title(String title) { /** * Sets the Title of the embed. *
You can provide {@code null} as url if no url should be used. - *

+ * *

Example * * @param title the title of the embed @@ -651,7 +651,7 @@ public REmbedBuilder title(String title, String url) { /** * Sets the Description of the embed. This is where the main chunk of text for an embed is typically placed. - *

+ * *

Example * * @param description the description of the embed, {@code null} to reset @@ -665,7 +665,7 @@ public REmbedBuilder description(CharSequence description) { /** * Appends to the description of the embed. This is where the main chunk of text for an embed is typically placed. - *

+ * *

Example * * @param description the string to append to the description of the embed @@ -682,9 +682,9 @@ public REmbedBuilder appendDescription(CharSequence description) { /** * Sets the Timestamp of the embed. - *

+ * *

Example - *

+ * *

Hint: You can get the current time using {@link Instant#now() Instant.now()} or convert time from a * millisecond representation by using {@link Instant#ofEpochMilli(long) Instant.ofEpochMilli(long)}; * @@ -712,14 +712,14 @@ public REmbedBuilder color(Color color) { /** * Sets the Thumbnail of the embed. - *

+ * *

Example - *

+ * *

Uploading images with Embeds *
When uploading an image * (using {@link MessageChannel#sendFile(File, Message) MessageChannel.sendFile(...)}) * you can reference said image using the specified filename as URI {@code attachment://filename.ext}. - *

+ * *

Example *


          * MessageChannel channel; // = reference of a MessageChannel
@@ -746,14 +746,14 @@ public REmbedBuilder thumbnail(String url) {
 
         /**
          * Sets the Image of the embed.
-         * 

+ * *

Example - *

+ * *

Uploading images with Embeds *
When uploading an image * (using {@link MessageChannel#sendFile(File, Message) MessageChannel.sendFile(...)}) * you can reference said image using the specified filename as URI {@code attachment://filename.ext}. - *

+ * *

Example *


          * MessageChannel channel; // = reference of a MessageChannel
@@ -783,7 +783,7 @@ public REmbedBuilder image(String url) {
          * Sets the Author of the embed. The author appears in the top left of the embed and can have a small
          * image beside it along with the author's name being made clickable by way of providing a url.
          * This convenience method just sets the name.
-         * 

+ * *

Example * * @param name the name of the author of the embed. If this is not set, the author will not appear in the embed @@ -798,7 +798,7 @@ public REmbedBuilder author(String name) { * Sets the Author of the embed. The author appears in the top left of the embed and can have a small * image beside it along with the author's name being made clickable by way of providing a url. * This convenience method just sets the name and the url. - *

+ * *

Example * * @param name the name of the author of the embed. If this is not set, the author will not appear in the embed @@ -817,14 +817,14 @@ public REmbedBuilder author(String name, String url) { /** * Sets the Author of the embed. The author appears in the top left of the embed and can have a small * image beside it along with the author's name being made clickable by way of providing a url. - *

+ * *

Example - *

+ * *

Uploading images with Embeds *
When uploading an image * (using {@link MessageChannel#sendFile(File, Message) MessageChannel.sendFile(...)}) * you can reference said image using the specified filename as URI {@code attachment://filename.ext}. - *

+ * *

Example *


          * MessageChannel channel; // = reference of a MessageChannel
@@ -855,14 +855,14 @@ public REmbedBuilder author(String name, String url, String iconUrl) {
 
         /**
          * Sets the Footer of the embed.
-         * 

+ * *

Example - *

+ * *

Uploading images with Embeds *
When uploading an image * (using {@link MessageChannel#sendFile(File, Message) MessageChannel.sendFile(...)}) * you can reference said image using the specified filename as URI {@code attachment://filename.ext}. - *

+ * *

Example *


          * MessageChannel channel; // = reference of a MessageChannel
@@ -891,10 +891,10 @@ public REmbedBuilder footer(String text, String iconUrl) {
 
         /**
          * Adds a Field to the embed.
-         * 

+ * *

Note: If a blank string is provided to either {@code name} or {@code value}, the blank string is replaced * with {@link net.dv8tion.jda.core.EmbedBuilder#ZERO_WIDTH_SPACE}. - *

+ * *

Example of Inline *

Example if Non-inline * @@ -915,7 +915,7 @@ public REmbedBuilder field(String name, String value, boolean inline) { /** * Adds a blank (empty) Field to the embed. - *

+ * *

Example of Inline *

Example of Non-inline * diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionBuilder.java index 45766325..396fd6eb 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionBuilder.java @@ -94,9 +94,9 @@ public interface EventActionBuilder { /** * WARNING THIS RETURNS A NEW BUILDER * - * @param finisher + * @param finisher a runnable that runs when this action is complete * - * @return + * @return a new builder */ default EventActionBuilder finish(Runnable finisher) { return finishWithResult(e -> { diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionFuture.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionFuture.java index f048bb2b..6a4d4fa6 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionFuture.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/EventActionFuture.java @@ -40,7 +40,7 @@ default int compareTo(@Nonnull Delayed o) { * this task should never run. If the task has already started, * then the task cannot be interrupted. If there is a timeout action * present, it will also be cancelled. - *

+ * *

After this method returns, subsequent calls to {@link #isDone} will * always return {@code true}. Subsequent calls to {@link #isCancelled} * will always return {@code true} if this method returned {@code true}. @@ -62,7 +62,7 @@ default boolean cancel(boolean mayInterruptIfRunning) { * and this task has not started when {@code cancel} is called, * this task should never run. If the task has already started, * then the task cannot be interrupted. - *

+ * *

After this method returns, subsequent calls to {@link #isDone} will * always return {@code true}. Subsequent calls to {@link #isCancelled} * will always return {@code true} if this method returned {@code true}. diff --git a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/ReactionEventActionBuilder.java b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/ReactionEventActionBuilder.java index 1ca747cb..46ab8ffe 100644 --- a/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/ReactionEventActionBuilder.java +++ b/src/main/java/com/github/breadmoirai/breadbot/plugins/waiter/ReactionEventActionBuilder.java @@ -40,12 +40,10 @@ * will overwrite any conditions already set, * which is all of these extension methods. * - * @param - * the result type + * @param the result type */ public interface ReactionEventActionBuilder extends EventActionBuilderExtension { - /** * Restrict condition to ReactionAddEvents only. * By default this will accept both reaction add and remove events. @@ -70,6 +68,8 @@ default ReactionEventActionBuilder onRemoveOnly() { /** * Matches the name of the reaction * + * @param emojiEmoteName the names of any emotes to match or the unicode of any emojis to match + * * @return this */ default ReactionEventActionBuilder withName(String... emojiEmoteName) { @@ -91,7 +91,8 @@ default ReactionEventActionBuilder withId(long... emoteIds) { return matching(event -> { final MessageReaction.ReactionEmote reactionEmote = event.getReaction().getReactionEmote(); final String id = reactionEmote.getId(); - if (id == null) return false; + if (id == null) + return false; final long idLong = reactionEmote.getIdLong(); for (long emoteId : emoteIds) { if (emoteId == idLong) { @@ -108,8 +109,7 @@ default ReactionEventActionBuilder withId(long... emoteIds) { * with {@link #stopIf(ObjectIntPredicate)}, then this predicate * with be combined with the set one with an AND. * - * @param reactionCount - * an IntPredicate that tests against the number of reactions + * @param reactionCount an IntPredicate that tests against the number of reactions * * @return this */ @@ -138,7 +138,6 @@ default ReactionEventActionBuilder onMessages(long... messageIds) { }); } - ReactionEventActionBuilder matching(Predicate condition); @Override @@ -156,7 +155,8 @@ default ReactionEventActionBuilder fromRoles(long... roleIds) { for (Role r : roles) { final long id = r.getIdLong(); for (long l : roleIds) { - if (id == l) return true; + if (id == l) + return true; } } return false; @@ -185,7 +185,8 @@ default ReactionEventActionBuilder fromUsers(long... userIds) { return matching(event -> { final long authorId = event.getUser().getIdLong(); for (long userId : userIds) { - if (authorId == userId) return true; + if (authorId == userId) + return true; } return false; });