From 07b33717ddf4c186fe48f46bde423dbecab21020 Mon Sep 17 00:00:00 2001 From: ZephyrKaOne <74645571+ZephyrKaOne@users.noreply.github.com> Date: Sat, 24 Sep 2022 22:31:23 +0200 Subject: [PATCH] Support for JDA 5.0.0-alpha.19 (#77) Update channel packages. Co-authored-by: Chew --- build.gradle | 2 +- .../jagrosh/jdautilities/command/Command.java | 18 +++--- .../jdautilities/command/CommandEvent.java | 64 ++++++++++--------- .../jdautilities/command/CooldownScope.java | 6 +- .../command/MessageContextMenu.java | 2 +- .../jdautilities/command/SlashCommand.java | 4 +- .../command/SlashCommandEvent.java | 10 +-- .../jdautilities/command/UserContextMenu.java | 2 +- .../command/impl/CommandClientImpl.java | 2 +- .../jdachewtils/command/OptionHelper.java | 4 +- .../commons/utils/FinderUtil.java | 29 ++++----- .../examples/command/AboutCommand.java | 10 +-- .../examples/command/GuildlistCommand.java | 9 +-- .../menu/ButtonEmbedPaginator.java | 2 +- .../jagrosh/jdautilities/menu/ButtonMenu.java | 4 +- .../jdautilities/menu/EmbedPaginator.java | 7 +- .../com/jagrosh/jdautilities/menu/Menu.java | 7 +- .../jdautilities/menu/OrderedMenu.java | 32 +++++----- .../jagrosh/jdautilities/menu/Paginator.java | 26 ++++---- .../jdautilities/menu/SelectionDialog.java | 26 ++++---- .../jagrosh/jdautilities/menu/Slideshow.java | 26 ++++---- 21 files changed, 147 insertions(+), 145 deletions(-) diff --git a/build.gradle b/build.gradle index 6f645b6c..b1083098 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ allprojects { version = versionInfo.values().join('.') ext { - jdaVersion = '5.0.0-alpha.18' + jdaVersion = '5.0.0-alpha.19' slf4jVersion = '1.7.36' okhttpVersion = '4.9.3' findbugsVersion = '3.0.2' diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/Command.java b/command/src/main/java/com/jagrosh/jdautilities/command/Command.java index d649a212..0774f393 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/Command.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/Command.java @@ -15,19 +15,19 @@ */ package com.jagrosh.jdautilities.command; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.GuildVoiceState; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; + import java.util.Arrays; import java.util.Locale; import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.Predicate; -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.AudioChannel; -import net.dv8tion.jda.api.entities.ChannelType; -import net.dv8tion.jda.api.entities.GuildVoiceState; -import net.dv8tion.jda.api.entities.TextChannel; - /** *

Commands In JDA-Utilities

@@ -99,7 +99,7 @@ public abstract class Command extends Interaction /** * {@code true} if the command may only be used in an NSFW - * {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} or DMs. + * {@link TextChannel} or DMs. * {@code false} if it may be used anywhere *
Default: {@code false} */ @@ -339,7 +339,7 @@ public boolean isCommandFor(String input) } /** - * Checks whether a command is allowed in a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} + * Checks whether a command is allowed in a {@link TextChannel} * by searching the channel topic for topic tags relating to the command. * *

{-{@link com.jagrosh.jdautilities.command.Command#name name}}, diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java b/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java index 1464cc7d..3685ccc6 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java @@ -22,6 +22,11 @@ import com.jagrosh.jdautilities.command.impl.CommandClientImpl; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.exceptions.PermissionException; @@ -38,7 +43,7 @@ * development. There are also "extension" methods for all methods found in MessageReceivedEvent. * *

Methods with "reply" in their name can be used to instantly send a {@link net.dv8tion.jda.api.entities.Message Message} - * response to the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} the MessageReceivedEvent was in. + * response to the {@link MessageChannel} the MessageReceivedEvent was in. *
All {@link net.dv8tion.jda.api.requests.RestAction RestAction} returned by sending a response using these * methods automatically {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction#queue()}, and no further developer * input is required. @@ -129,7 +134,7 @@ public CommandClient getClient() * contained by this CommandEvent. * *

This method is exposed for those who wish to use linked deletion but may require usage of - * {@link net.dv8tion.jda.api.entities.MessageChannel#sendMessage(MessageCreateData) MessageChannel#sendMessage()} + * {@link MessageChannel#sendMessage(MessageCreateData) MessageChannel#sendMessage()} * or for other reasons cannot use the standard {@code reply()} methods. * *

If the Message provided is not from the bot (IE: {@link net.dv8tion.jda.api.entities.SelfUser SelfUser}), @@ -352,8 +357,8 @@ public void reply(MessageCreateData message, Consumer success, Consumer *

The {@link net.dv8tion.jda.api.requests.RestAction RestAction} returned by * sending the response as a {@link net.dv8tion.jda.api.entities.Message Message} * automatically does {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction#queue()}. - * - *

This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} + * + *

This method uses {@link MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} * to send the File. For more information on what a bot may send using this, you may find the info in that method. * * @param file @@ -373,8 +378,8 @@ public void reply(File file, String filename) *

The {@link net.dv8tion.jda.api.requests.RestAction RestAction} returned by * sending the response as a {@link net.dv8tion.jda.api.entities.Message Message} * automatically does {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction#queue()}. - * - *

This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} + * + *

This method uses {@link MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} * to send the File. For more information on what a bot may send using this, you may find the info in that method. * * @param message @@ -441,8 +446,8 @@ public void replyOrAlternate(MessageEmbed embed, String alternateMessage) *

The {@link net.dv8tion.jda.api.requests.RestAction RestAction} returned by * sending the response as a {@link net.dv8tion.jda.api.entities.Message Message} * automatically does {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction#queue()}. - * - *

This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} + * + *

This method uses {@link MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} * to send the File. For more information on what a bot may send using this, you may find the info in that method. * *

NOTE: This alternate String message can exceed the 2000 character cap, and will @@ -473,7 +478,7 @@ public void replyOrAlternate(String message, File file, String filename, String /** * Replies with a String message sent to the calling {@link net.dv8tion.jda.api.entities.User User}'s - * {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -500,7 +505,7 @@ public void replyInDm(String message) /** * Replies with a String message sent to the calling {@link net.dv8tion.jda.api.entities.User User}'s - * {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -530,7 +535,7 @@ public void replyInDm(String message, Consumer success) /** * Replies with a String message sent to the calling {@link net.dv8tion.jda.api.entities.User User}'s - * {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -562,7 +567,7 @@ public void replyInDm(String message, Consumer success, ConsumerIf the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -586,7 +591,7 @@ public void replyInDm(MessageEmbed embed) /** * Replies with a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} sent to the - * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -613,7 +618,7 @@ public void replyInDm(MessageEmbed embed, Consumer success) /** * Replies with a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} sent to the - * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -642,7 +647,7 @@ public void replyInDm(MessageEmbed embed, Consumer success, ConsumerIf the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -666,7 +671,7 @@ public void replyInDm(MessageCreateData message) /** * Replies with a {@link net.dv8tion.jda.api.entities.Message Message} sent to the - * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -693,7 +698,7 @@ public void replyInDm(MessageCreateData message, Consumer success) /** * Replies with a {@link net.dv8tion.jda.api.entities.Message Message} sent to the - * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. + * calling {@link net.dv8tion.jda.api.entities.User User}'s {@link PrivateChannel}. * *

If the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. @@ -723,16 +728,16 @@ public void replyInDm(Message message, Consumer success, ConsumerIf the User to be Direct Messaged does not already have a PrivateChannel * open to send messages to, this method will automatically open one. * *

The {@link net.dv8tion.jda.api.requests.RestAction RestAction} returned by * sending the response as a {@link net.dv8tion.jda.api.entities.Message Message} * automatically does {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction#queue()}. - * - *

This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} + * + *

This method uses {@link MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} * to send the File. For more information on what a bot may send using this, you may find the info in that method. * * @param message @@ -1082,7 +1087,7 @@ public User getAuthor() } /** - * Gets the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} that the CommandEvent + * Gets the {@link MessageChannel} that the CommandEvent * was triggered on. * * @return The MessageChannel that the CommandEvent was triggered on @@ -1093,9 +1098,8 @@ public MessageChannel getChannel() } /** - * Gets the {@link net.dv8tion.jda.api.entities.ChannelType ChannelType} of the - * {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} that the CommandEvent was triggered on. - * + * Gets the {@link ChannelType} of the {@link MessageChannel} that the CommandEvent was triggered on. + * * @return The ChannelType of the MessageChannel that this CommandEvent was triggered on */ public ChannelType getChannelType() @@ -1147,7 +1151,7 @@ public Message getMessage() } /** - * Gets the {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} that this CommandEvent + * Gets the {@link PrivateChannel} that this CommandEvent * may have taken place on, or {@code null} if it didn't happen on a PrivateChannel. * * @return The PrivateChannel that this CommandEvent may have taken place on, or null @@ -1169,7 +1173,7 @@ public long getResponseNumber() } /** - * Gets the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that this CommandEvent + * Gets the {@link TextChannel} that this CommandEvent * may have taken place on, or {@code null} if it didn't happen on a TextChannel. * * @return The TextChannel this CommandEvent may have taken place on, or null @@ -1193,13 +1197,13 @@ public GuildMessageChannel getGuildChannel() } /** - * Compares a provided {@link net.dv8tion.jda.api.entities.ChannelType ChannelType} with the one this + * Compares a provided {@link ChannelType} with the one this * CommandEvent occurred on, returning {@code true} if they are the same ChannelType. * * @param channelType * The ChannelType to compare - * - * @return {@code true} if the CommandEvent originated from a {@link net.dv8tion.jda.api.entities.MessageChannel} + * + * @return {@code true} if the CommandEvent originated from a {@link MessageChannel} * of the provided ChannelType, otherwise {@code false}. */ public boolean isFromType(ChannelType channelType) diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/CooldownScope.java b/command/src/main/java/com/jagrosh/jdautilities/command/CooldownScope.java index ce6e799f..140f202c 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/CooldownScope.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/CooldownScope.java @@ -65,7 +65,7 @@ public enum CooldownScope USER("U:%d",""), /** - * Applies the cooldown to the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} the + * Applies the cooldown to the {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} the * command is called in. * *

The key for this is generated in the format @@ -77,7 +77,7 @@ public enum CooldownScope /** * Applies the cooldown to the calling {@link net.dv8tion.jda.api.entities.User User} local to the - * {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} the command is called in. + * {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} the command is called in. * *

The key for this is generated in the format *