From 74ed1dc98c13f89d5598e6ec193395cd79d23316 Mon Sep 17 00:00:00 2001 From: ZephyrKaOne Date: Fri, 16 Sep 2022 13:52:37 +0200 Subject: [PATCH 1/6] Change JDA version 18 -> 19 --- build.gradle | 2 +- .../jagrosh/jdautilities/command/Command.java | 6 +- .../jdautilities/command/CommandEvent.java | 5 + .../command/MessageContextMenu.java | 2 +- .../jdautilities/command/SlashCommand.java | 6 +- .../command/SlashCommandEvent.java | 8 +- .../jdautilities/command/UserContextMenu.java | 2 +- .../command/impl/CommandClientImpl.java | 2 +- .../jdachewtils/command/OptionHelper.java | 4 +- .../commons/utils/FinderUtil.java | 3 + examples/README.md | 4 - examples/build.gradle | 24 ---- .../examples/command/AboutCommand.java | 123 ------------------ .../examples/command/GuildlistCommand.java | 105 --------------- .../examples/command/PingCommand.java | 51 -------- .../examples/command/RoleinfoCommand.java | 118 ----------------- .../examples/command/ServerinfoCommand.java | 91 ------------- .../examples/command/ShutdownCommand.java | 48 ------- .../jdautilities/examples/doc/Author.java | 45 ------- .../jdautilities/examples/package-info.java | 29 ----- .../menu/ButtonEmbedPaginator.java | 2 +- .../jagrosh/jdautilities/menu/ButtonMenu.java | 2 +- .../jdautilities/menu/EmbedPaginator.java | 1 + .../com/jagrosh/jdautilities/menu/Menu.java | 1 + .../jdautilities/menu/OrderedMenu.java | 8 +- .../jagrosh/jdautilities/menu/Paginator.java | 2 +- .../jdautilities/menu/SelectionDialog.java | 2 +- .../jagrosh/jdautilities/menu/Slideshow.java | 2 +- 28 files changed, 35 insertions(+), 663 deletions(-) delete mode 100644 examples/README.md delete mode 100644 examples/build.gradle delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java delete mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java 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..14f710f0 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/Command.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/Command.java @@ -23,10 +23,10 @@ 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; +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; /** 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..81e6de30 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; diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/MessageContextMenu.java b/command/src/main/java/com/jagrosh/jdautilities/command/MessageContextMenu.java index 63cff112..722ab772 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/MessageContextMenu.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/MessageContextMenu.java @@ -16,9 +16,9 @@ package com.jagrosh.jdautilities.command; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.AudioChannel; import net.dv8tion.jda.api.entities.GuildVoiceState; import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.Commands; diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java index 9b476e3e..bace10b4 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java @@ -17,10 +17,10 @@ import net.dv8tion.jda.annotations.ForRemoval; 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.Member; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent; import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -272,7 +272,7 @@ else if(!selfMember.hasPermission(vc, p)) } // nsfw check - if (nsfwOnly && event.getChannelType() == ChannelType.TEXT && !event.getTextChannel().isNSFW()) + if (nsfwOnly && event.getChannelType() == ChannelType.TEXT && !event.getChannel().asTextChannel().isNSFW()) { terminate(event, "This command may only be used in NSFW text channels!", client); return; diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java index 86b2b1ca..90ada9b6 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java @@ -15,15 +15,15 @@ */ package com.jagrosh.jdautilities.command; -import net.dv8tion.jda.api.entities.ChannelType; -import net.dv8tion.jda.api.entities.GuildChannel; import net.dv8tion.jda.api.entities.IMentionable; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.User; +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.GuildChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import org.jetbrains.annotations.Contract; diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/UserContextMenu.java b/command/src/main/java/com/jagrosh/jdautilities/command/UserContextMenu.java index 50b949ea..b9072b78 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/UserContextMenu.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/UserContextMenu.java @@ -16,9 +16,9 @@ package com.jagrosh.jdautilities.command; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.AudioChannel; import net.dv8tion.jda.api.entities.GuildVoiceState; import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.Commands; diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java index 36a808c1..bfa7c8bc 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java @@ -36,10 +36,10 @@ import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Activity; -import net.dv8tion.jda.api.entities.ChannelType; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.events.GenericEvent; import net.dv8tion.jda.api.events.ReadyEvent; import net.dv8tion.jda.api.events.ShutdownEvent; diff --git a/command/src/main/java/pw/chew/jdachewtils/command/OptionHelper.java b/command/src/main/java/pw/chew/jdachewtils/command/OptionHelper.java index fcc25fba..3c11cf81 100644 --- a/command/src/main/java/pw/chew/jdachewtils/command/OptionHelper.java +++ b/command/src/main/java/pw/chew/jdachewtils/command/OptionHelper.java @@ -18,12 +18,12 @@ import com.jagrosh.jdautilities.command.SlashCommandEvent; import net.dv8tion.jda.annotations.DeprecatedSince; import net.dv8tion.jda.annotations.ForRemoval; -import net.dv8tion.jda.api.entities.GuildChannel; import net.dv8tion.jda.api.entities.IMentionable; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; diff --git a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java index 26168b56..8708199b 100644 --- a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java +++ b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java @@ -15,6 +15,9 @@ */ package com.jagrosh.jdautilities.commons.utils; +import net.dv8tion.jda.api.entities.channel.concrete.Category; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.entities.emoji.RichCustomEmoji; import net.dv8tion.jda.api.sharding.ShardManager; diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index a0d089cf..00000000 --- a/examples/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Examples Package - -Contains various examples demonstrating some functionality of the other packages -that are part of this library. diff --git a/examples/build.gradle b/examples/build.gradle deleted file mode 100644 index 70071b68..00000000 --- a/examples/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -dependencies { - compileOnly jda() - implementation slf4j() - - implementation commons() - implementation command() - implementation menu() - implementation doc() -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java deleted file mode 100644 index 83fa4a1d..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo; -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import com.jagrosh.jdautilities.doc.standard.CommandInfo; -import com.jagrosh.jdautilities.examples.doc.Author; -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.ApplicationInfo; -import net.dv8tion.jda.api.entities.ChannelType; -import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.JDAInfo; -import net.dv8tion.jda.api.Permission; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.awt.*; - -/** - * - * @author John Grosh (jagrosh) - */ -@CommandInfo( - name = "About", - description = "Gets information about the bot." -) -@Author("John Grosh (jagrosh)") -public class AboutCommand extends Command { - private boolean IS_AUTHOR = true; - private String REPLACEMENT_ICON = "+"; - private final Color color; - private final String description; - private final Permission[] perms; - private String oauthLink; - private final String[] features; - - public AboutCommand(Color color, String description, String[] features, Permission... perms) - { - this.color = color; - this.description = description; - this.features = features; - this.name = "about"; - this.help = "shows info about the bot"; - this.guildOnly = false; - this.perms = perms; - this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; - } - - public void setIsAuthor(boolean value) - { - this.IS_AUTHOR = value; - } - - public void setReplacementCharacter(String value) - { - this.REPLACEMENT_ICON = value; - } - - @Override - protected void execute(CommandEvent event) { - if (oauthLink == null) { - try { - ApplicationInfo info = event.getJDA().retrieveApplicationInfo().complete(); - oauthLink = info.isBotPublic() ? info.getInviteUrl(0L, perms) : ""; - } catch (Exception e) { - Logger log = LoggerFactory.getLogger("OAuth2"); - log.error("Could not generate invite link ", e); - oauthLink = ""; - } - } - EmbedBuilder builder = new EmbedBuilder(); - builder.setColor(event.isFromType(ChannelType.TEXT) ? event.getGuild().getSelfMember().getColor() : color); - builder.setAuthor("All about " + event.getSelfUser().getName() + "!", null, event.getSelfUser().getAvatarUrl()); - boolean join = !(event.getClient().getServerInvite() == null || event.getClient().getServerInvite().isEmpty()); - boolean inv = !oauthLink.isEmpty(); - String invline = "\n" + (join ? "Join my server [`here`](" + event.getClient().getServerInvite() + ")" : (inv ? "Please " : "")) - + (inv ? (join ? ", or " : "") + "[`invite`](" + oauthLink + ") me to your server" : "") + "!"; - String author = event.getJDA().getUserById(event.getClient().getOwnerId())==null ? "<@" + event.getClient().getOwnerId()+">" - : event.getJDA().getUserById(event.getClient().getOwnerId()).getName(); - StringBuilder descr = new StringBuilder().append("Hello! I am **").append(event.getSelfUser().getName()).append("**, ") - .append(description).append("\nI ").append(IS_AUTHOR ? "was written in Java" : "am owned").append(" by **") - .append(author).append("** using " + JDAUtilitiesInfo.AUTHOR + "'s [Commands Extension](" + JDAUtilitiesInfo.GITHUB + ") (") - .append(JDAUtilitiesInfo.VERSION).append(") and the [JDA library](https://github.com/DV8FromTheWorld/JDA) (") - .append(JDAInfo.VERSION).append(")\nType `").append(event.getClient().getTextualPrefix()).append(event.getClient().getHelpWord()) - .append("` to see my commands!").append(join || inv ? invline : "").append("\n\nSome of my features include: ```css"); - for (String feature : features) - descr.append("\n").append(event.getClient().getSuccess().startsWith("<") ? REPLACEMENT_ICON : event.getClient().getSuccess()).append(" ").append(feature); - descr.append(" ```"); - builder.setDescription(descr); - if (event.getJDA().getShardInfo() == JDA.ShardInfo.SINGLE) - { - builder.addField("Stats", event.getJDA().getGuilds().size() + " servers\n1 shard", true); - builder.addField("Users", event.getJDA().getUsers().size() + " unique\n" + event.getJDA().getGuilds().stream().mapToInt(g -> g.getMembers().size()).sum() + " total", true); - builder.addField("Channels", event.getJDA().getTextChannels().size() + " Text\n" + event.getJDA().getVoiceChannels().size() + " Voice", true); - } - else - { - builder.addField("Stats", (event.getClient()).getTotalGuilds() + " Servers\nShard " + (event.getJDA().getShardInfo().getShardId() + 1) - + "/" + event.getJDA().getShardInfo().getShardTotal(), true); - builder.addField("This shard", event.getJDA().getUsers().size() + " Users\n" + event.getJDA().getGuilds().size() + " Servers", true); - builder.addField("", event.getJDA().getTextChannels().size() + " Text Channels\n" + event.getJDA().getVoiceChannels().size() + " Voice Channels", true); - } - builder.setFooter("Last restart", null); - builder.setTimestamp(event.getClient().getStartTime()); - event.reply(builder.build()); - } - -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java deleted file mode 100644 index 81a7fd74..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import java.awt.Color; -import java.util.concurrent.TimeUnit; -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import com.jagrosh.jdautilities.doc.standard.CommandInfo; -import com.jagrosh.jdautilities.doc.standard.Error; -import com.jagrosh.jdautilities.doc.standard.RequiredPermissions; -import com.jagrosh.jdautilities.examples.doc.Author; -import com.jagrosh.jdautilities.menu.Paginator; -import com.jagrosh.jdautilities.commons.waiter.EventWaiter; -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.ChannelType; -import net.dv8tion.jda.api.exceptions.PermissionException; - -/** - * - * @author John Grosh (jagrosh) - */ -@CommandInfo( - name = "Guildlist", - description = "Gets a paginated list of the guilds the bot is on.", - requirements = { - "The bot has all necessary permissions.", - "The user is the bot's owner." - } -) -@Error( - value = "If arguments are provided, but they are not an integer.", - response = "[PageNumber] is not a valid integer!" -) -@RequiredPermissions({Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ADD_REACTION}) -@Author("John Grosh (jagrosh)") -public class GuildlistCommand extends Command { - - private final Paginator.Builder pbuilder; - public GuildlistCommand(EventWaiter waiter) - { - this.name = "guildlist"; - this.help = "shows the list of guilds the bot is on"; - this.arguments = "[pagenum]"; - this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ADD_REACTION}; - this.guildOnly = false; - this.ownerCommand = true; - pbuilder = new Paginator.Builder().setColumns(1) - .setItemsPerPage(10) - .showPageNumbers(true) - .waitOnSinglePage(false) - .useNumberedItems(false) - .setFinalAction(m -> { - try { - m.clearReactions().queue(); - } catch(PermissionException ex) { - m.delete().queue(); - } - }) - .setEventWaiter(waiter) - .setTimeout(1, TimeUnit.MINUTES); - } - - @Override - protected void execute(CommandEvent event) { - int page = 1; - if(!event.getArgs().isEmpty()) - { - try - { - page = Integer.parseInt(event.getArgs()); - } - catch(NumberFormatException e) - { - event.reply(event.getClient().getError()+" `"+event.getArgs()+"` is not a valid integer!"); - return; - } - } - pbuilder.clearItems(); - event.getJDA().getGuilds().stream() - .map(g -> "**"+g.getName()+"** (ID:"+g.getId()+") ~ "+g.getMembers().size()+" Members") - .forEach(pbuilder::addItems); - Paginator p = pbuilder.setColor(event.isFromType(ChannelType.TEXT) ? event.getSelfMember().getColor() : Color.black) - .setText(event.getClient().getSuccess()+" Guilds that **"+event.getSelfUser().getName()+"** is connected to" - +(event.getJDA().getShardInfo()== JDA.ShardInfo.SINGLE ? ":" : "(Shard ID "+event.getJDA().getShardInfo().getShardId()+"):")) - .setUsers(event.getAuthor()) - .build(); - p.paginate(event.getChannel(), page); - } - -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java deleted file mode 100644 index c5a25571..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import java.time.temporal.ChronoUnit; -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import com.jagrosh.jdautilities.doc.standard.CommandInfo; -import com.jagrosh.jdautilities.examples.doc.Author; - -/** - * - * @author John Grosh (jagrosh) - */ -@CommandInfo( - name = {"Ping", "Pong"}, - description = "Checks the bot's latency" -) -@Author("John Grosh (jagrosh)") -public class PingCommand extends Command { - - public PingCommand() - { - this.name = "ping"; - this.help = "checks the bot's latency"; - this.guildOnly = false; - this.aliases = new String[]{"pong"}; - } - - @Override - protected void execute(CommandEvent event) { - event.reply("Ping: ...", m -> { - long ping = event.getMessage().getTimeCreated().until(m.getTimeCreated(), ChronoUnit.MILLIS); - m.editMessage("Ping: " + ping + "ms | Websocket: " + event.getJDA().getGatewayPing() + "ms").queue(); - }); - } - -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java deleted file mode 100644 index 68e28eef..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import com.jagrosh.jdautilities.commons.utils.FinderUtil; -import java.awt.Color; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Locale; - -import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; - -/** - * - * @author John Grosh (jagrosh) - */ -public class RoleinfoCommand extends Command -{ - private final static String LINESTART = "\u25AB"; // ▫ - private final static String ROLE_EMOJI = "\uD83C\uDFAD"; // 🎭 - - public RoleinfoCommand() - { - this.name = "roleinfo"; - this.aliases = new String[]{"rinfo","rankinfo"}; - this.help = "shows info about a role"; - this.arguments = ""; - this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; - this.guildOnly = true; - } - - @Override - protected void execute(CommandEvent event) - { - Role role; - if(event.getArgs().isEmpty()) - { - event.replyError("Please provide the name of a role!"); - return; - } - else - { - List found = FinderUtil.findRoles(event.getArgs(), event.getGuild()); - if(found.isEmpty()) - { - event.replyError("I couldn't find the role you were looking for!"); - return; - } - else if(found.size()>1) - { - event.replyWarning(listOfRoles(found, event.getArgs())); - return; - } - else - { - role = found.get(0); - } - } - - String title = (ROLE_EMOJI + " Information about **" + role.getName() + "**:") - .replace("@everyone", "@\u0435veryone") // cyrillic e - .replace("@here", "@h\u0435re") // cyrillic e - .replace("discord.gg/", "dis\u0441ord.gg/"); // cyrillic c;; - List list = role.isPublicRole() ? event.getGuild().getMembers() : event.getGuild().getMembersWithRoles(role); - Color color = role.getColor(); - StringBuilder desr = new StringBuilder(LINESTART + "ID: **" + role.getId() + "**\n" - + LINESTART + "Creation: **" + role.getTimeCreated().format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**\n" - + LINESTART + "Position: **" + role.getPosition()+"**\n" - + LINESTART + "Color: **#" + (color==null ? "000000" : Integer.toHexString(color.getRGB()).toUpperCase(Locale.ROOT).substring(2)) + "**\n" - + LINESTART + "Mentionable: **" + role.isMentionable() + "**\n" - + LINESTART + "Hoisted: **" + role.isHoisted() + "**\n" - + LINESTART + "Managed: **" + role.isManaged() + "**\n" - + LINESTART + "Permissions: "); - if(role.getPermissions().isEmpty()) - desr.append("None"); - else - desr.append(role.getPermissions().stream().map(p -> "`, `"+p.getName()).reduce("", String::concat).substring(3)).append("`"); - desr.append("\n").append(LINESTART).append("Members: **").append(list.size()).append("**\n"); - if(list.size() * 24 <= 2048-desr.length()) - list.forEach(m -> desr.append("<@").append(m.getUser().getId()).append("> ")); - - event.reply(new MessageCreateBuilder() - .setContent(title) - .setEmbeds(new EmbedBuilder() - .setDescription(desr.toString().trim()) - .setColor(role.getColor()).build()) - .build()); - } - - private static String listOfRoles(List list, String query) - { - String out = String.format("**Multiple roles found matching \"%s\":**", query); - for(int i = 0; i < 6 && i < list.size(); i++) - out += "\n - " + list.get(i).getName() + " (ID:" + list.get(i).getId() + ")"; - if(list.size() > 6) - out += "\n**And " + (list.size() - 6) + " more...**"; - return out; - } -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java deleted file mode 100644 index b7a1226f..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import java.time.format.DateTimeFormatter; -import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.OnlineStatus; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.Guild; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; - -/** - * - * @author John Grosh (jagrosh) - */ -public class ServerinfoCommand extends Command -{ - private final static String LINESTART = "\u25AB"; // ▫ - private final static String GUILD_EMOJI = "\uD83D\uDDA5"; // 🖥 - private final static String NO_REGION = "\u2754"; // ❔ - - public ServerinfoCommand() - { - this.name = "serverinfo"; - this.aliases = new String[]{"server","guildinfo"}; - this.help = "shows server info"; - this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; - this.guildOnly = true; - } - - @Override - protected void execute(CommandEvent event) - { - Guild guild = event.getGuild(); - Member owner = guild.getOwner(); - long onlineCount = guild.getMembers().stream().filter(u -> u.getOnlineStatus() != OnlineStatus.OFFLINE).count(); - long botCount = guild.getMembers().stream().filter(m -> m.getUser().isBot()).count(); - EmbedBuilder builder = new EmbedBuilder(); - String title = (GUILD_EMOJI + " Information about **" + guild.getName() + "**:") - .replace("@everyone", "@\u0435veryone") // cyrillic e - .replace("@here", "@h\u0435re") // cyrillic e - .replace("discord.gg/", "dis\u0441ord.gg/"); // cyrillic c; - String verif; - switch(guild.getVerificationLevel()) - { - case VERY_HIGH: - verif = "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"; - break; - case HIGH: - verif = "(╯°□°)╯︵ ┻━┻"; - break; - default: - verif = guild.getVerificationLevel().name(); - break; - } - String str = LINESTART + "ID: **" + guild.getId() + "**\n" - + LINESTART + "Owner: " + (owner == null ? "Unknown" : "**" + owner.getUser().getName() + "**#" + owner.getUser().getDiscriminator()) + "\n" - + LINESTART + "Creation: **" + guild.getTimeCreated().format(DateTimeFormatter.RFC_1123_DATE_TIME) + "**\n" - + LINESTART + "Users: **" + guild.getMemberCache().size() + "** (" + onlineCount + " online, " + botCount + " bots)\n" - + LINESTART + "Channels: **" + guild.getTextChannelCache().size() + "** Text, **" + guild.getVoiceChannelCache().size() + "** Voice, **" + guild.getCategoryCache().size() + "** Categories\n" - + LINESTART + "Verification: **" + verif + "**"; - if(!guild.getFeatures().isEmpty()) - str += "\n" + LINESTART + "Features: **" + String.join("**, **", guild.getFeatures()) + "**"; - if(guild.getSplashId() != null) - { - builder.setImage(guild.getSplashUrl() + "?size=1024"); - str += "\n" + LINESTART + "Splash: "; - } - if(guild.getIconUrl()!=null) - builder.setThumbnail(guild.getIconUrl()); - builder.setColor(owner == null ? null : owner.getColor()); - builder.setDescription(str); - event.reply(new MessageCreateBuilder().setContent(title).setEmbeds(builder.build()).build()); - } -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java deleted file mode 100644 index 82349a3f..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.command; - -import com.jagrosh.jdautilities.command.Command; -import com.jagrosh.jdautilities.command.CommandEvent; -import com.jagrosh.jdautilities.doc.standard.CommandInfo; -import com.jagrosh.jdautilities.examples.doc.Author; - -/** - * - * @author John Grosh (jagrosh) - */ -@CommandInfo( - name = "Shutdown", - description = "Safely shuts down the bot." -) -@Author("John Grosh (jagrosh)") -public class ShutdownCommand extends Command { - - public ShutdownCommand() - { - this.name = "shutdown"; - this.help = "safely shuts off the bot"; - this.guildOnly = false; - this.ownerCommand = true; - } - - @Override - protected void execute(CommandEvent event) { - event.reactWarning(); - event.getJDA().shutdown(); - } - -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java deleted file mode 100644 index 6c64a298..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.jagrosh.jdautilities.examples.doc; - -import com.jagrosh.jdautilities.doc.ConvertedBy; -import com.jagrosh.jdautilities.doc.DocConverter; - -import java.lang.annotation.*; - -/** - * Annotation to mark a command's specific author. - * - * @since 2.0 - * @author Kaidan Gustave - */ -@ConvertedBy(Author.Converter.class) -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.METHOD}) -public @interface Author -{ - String value(); - - class Converter implements DocConverter - { - @Override - public String read(Author annotation) - { - return String.format("**Author:** %s", annotation.value()); - } - } -} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java deleted file mode 100644 index b8128298..00000000 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Common package for all available example classes.
- * - *

The contents of this package are summarized as follows: - *

    - *
  • {@link com.jagrosh.jdautilities.examples.command Example Commands Package} - *
    Contains all example commands.
  • - * - *
  • {@link com.jagrosh.jdautilities.examples.doc Example CommandDoc Package} - *
    Contains all example CommandDoc annotations.
  • - *
- */ -package com.jagrosh.jdautilities.examples; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonEmbedPaginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonEmbedPaginator.java index a77b5c41..103ec808 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonEmbedPaginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonEmbedPaginator.java @@ -18,10 +18,10 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; import net.dv8tion.jda.api.interactions.components.buttons.Button; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java index bc3272aa..9e9269f8 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java @@ -18,9 +18,9 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent; import net.dv8tion.jda.api.requests.RestAction; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java index 7ee95f50..ac80efd1 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java @@ -18,6 +18,7 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java index 5fd8b39c..79bcdc03 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java @@ -22,6 +22,7 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import javax.annotation.Nullable; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java index 517c89c1..e8a0f1d2 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java @@ -27,12 +27,12 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.ChannelType; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; -import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.User; +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.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; @@ -114,7 +114,7 @@ public void display(MessageChannel channel) // Is from text channel // Does not allow typed input // Does not have permission to add reactions - if(channel.getType()==ChannelType.TEXT + if(channel.getType()== ChannelType.TEXT && !allowTypedInput && !((TextChannel)channel).getGuild().getSelfMember().hasPermission((TextChannel) channel, Permission.MESSAGE_ADD_REACTION)) throw new PermissionException("Must be able to add reactions if not allowing typed input!"); diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java index b5c305b1..979c4d41 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java @@ -27,9 +27,9 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java index 54600ca3..e7a0d59f 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java @@ -28,9 +28,9 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent; import net.dv8tion.jda.api.exceptions.PermissionException; diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java index 55faeb7e..1ed4750e 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java @@ -27,9 +27,9 @@ import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; From c2f2017bec675fe46a264d0003a1741d3d1fbdf9 Mon Sep 17 00:00:00 2001 From: ZephyrKaOne Date: Fri, 16 Sep 2022 15:05:05 +0200 Subject: [PATCH 2/6] Change JDA version 18 -> 19 --- .../java/com/jagrosh/jdautilities/command/SlashCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java index bace10b4..ebbe5c47 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java @@ -272,7 +272,7 @@ else if(!selfMember.hasPermission(vc, p)) } // nsfw check - if (nsfwOnly && event.getChannelType() == ChannelType.TEXT && !event.getChannel().asTextChannel().isNSFW()) + if (nsfwOnly && event.getChannelType() == ChannelType.TEXT && !event.getTextChannel().isNSFW()) { terminate(event, "This command may only be used in NSFW text channels!", client); return; From 944efa7e9ac55c18720ac3019c8ccb0d33314ad2 Mon Sep 17 00:00:00 2001 From: ZephyrKaOne Date: Fri, 16 Sep 2022 15:26:40 +0200 Subject: [PATCH 3/6] Change JDA version 18 -> 19 --- examples/README.md | 4 + examples/build.gradle | 24 ++++ .../examples/command/AboutCommand.java | 123 ++++++++++++++++++ .../examples/command/GuildlistCommand.java | 105 +++++++++++++++ .../examples/command/PingCommand.java | 51 ++++++++ .../examples/command/RoleinfoCommand.java | 118 +++++++++++++++++ .../examples/command/ServerinfoCommand.java | 91 +++++++++++++ .../examples/command/ShutdownCommand.java | 48 +++++++ .../jdautilities/examples/doc/Author.java | 45 +++++++ .../jdautilities/examples/package-info.java | 29 +++++ 10 files changed, 638 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/build.gradle create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java create mode 100644 examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..a0d089cf --- /dev/null +++ b/examples/README.md @@ -0,0 +1,4 @@ +# Examples Package + +Contains various examples demonstrating some functionality of the other packages +that are part of this library. diff --git a/examples/build.gradle b/examples/build.gradle new file mode 100644 index 00000000..70071b68 --- /dev/null +++ b/examples/build.gradle @@ -0,0 +1,24 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +dependencies { + compileOnly jda() + implementation slf4j() + + implementation commons() + implementation command() + implementation menu() + implementation doc() +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java new file mode 100644 index 00000000..9c82b108 --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java @@ -0,0 +1,123 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo; +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.doc.standard.CommandInfo; +import com.jagrosh.jdautilities.examples.doc.Author; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.ApplicationInfo; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.JDAInfo; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.awt.*; + +/** + * + * @author John Grosh (jagrosh) + */ +@CommandInfo( + name = "About", + description = "Gets information about the bot." +) +@Author("John Grosh (jagrosh)") +public class AboutCommand extends Command { + private boolean IS_AUTHOR = true; + private String REPLACEMENT_ICON = "+"; + private final Color color; + private final String description; + private final Permission[] perms; + private String oauthLink; + private final String[] features; + + public AboutCommand(Color color, String description, String[] features, Permission... perms) + { + this.color = color; + this.description = description; + this.features = features; + this.name = "about"; + this.help = "shows info about the bot"; + this.guildOnly = false; + this.perms = perms; + this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; + } + + public void setIsAuthor(boolean value) + { + this.IS_AUTHOR = value; + } + + public void setReplacementCharacter(String value) + { + this.REPLACEMENT_ICON = value; + } + + @Override + protected void execute(CommandEvent event) { + if (oauthLink == null) { + try { + ApplicationInfo info = event.getJDA().retrieveApplicationInfo().complete(); + oauthLink = info.isBotPublic() ? info.getInviteUrl(0L, perms) : ""; + } catch (Exception e) { + Logger log = LoggerFactory.getLogger("OAuth2"); + log.error("Could not generate invite link ", e); + oauthLink = ""; + } + } + EmbedBuilder builder = new EmbedBuilder(); + builder.setColor(event.isFromType(ChannelType.TEXT) ? event.getGuild().getSelfMember().getColor() : color); + builder.setAuthor("All about " + event.getSelfUser().getName() + "!", null, event.getSelfUser().getAvatarUrl()); + boolean join = !(event.getClient().getServerInvite() == null || event.getClient().getServerInvite().isEmpty()); + boolean inv = !oauthLink.isEmpty(); + String invline = "\n" + (join ? "Join my server [`here`](" + event.getClient().getServerInvite() + ")" : (inv ? "Please " : "")) + + (inv ? (join ? ", or " : "") + "[`invite`](" + oauthLink + ") me to your server" : "") + "!"; + String author = event.getJDA().getUserById(event.getClient().getOwnerId())==null ? "<@" + event.getClient().getOwnerId()+">" + : event.getJDA().getUserById(event.getClient().getOwnerId()).getName(); + StringBuilder descr = new StringBuilder().append("Hello! I am **").append(event.getSelfUser().getName()).append("**, ") + .append(description).append("\nI ").append(IS_AUTHOR ? "was written in Java" : "am owned").append(" by **") + .append(author).append("** using " + JDAUtilitiesInfo.AUTHOR + "'s [Commands Extension](" + JDAUtilitiesInfo.GITHUB + ") (") + .append(JDAUtilitiesInfo.VERSION).append(") and the [JDA library](https://github.com/DV8FromTheWorld/JDA) (") + .append(JDAInfo.VERSION).append(")\nType `").append(event.getClient().getTextualPrefix()).append(event.getClient().getHelpWord()) + .append("` to see my commands!").append(join || inv ? invline : "").append("\n\nSome of my features include: ```css"); + for (String feature : features) + descr.append("\n").append(event.getClient().getSuccess().startsWith("<") ? REPLACEMENT_ICON : event.getClient().getSuccess()).append(" ").append(feature); + descr.append(" ```"); + builder.setDescription(descr); + if (event.getJDA().getShardInfo() == JDA.ShardInfo.SINGLE) + { + builder.addField("Stats", event.getJDA().getGuilds().size() + " servers\n1 shard", true); + builder.addField("Users", event.getJDA().getUsers().size() + " unique\n" + event.getJDA().getGuilds().stream().mapToInt(g -> g.getMembers().size()).sum() + " total", true); + builder.addField("Channels", event.getJDA().getTextChannels().size() + " Text\n" + event.getJDA().getVoiceChannels().size() + " Voice", true); + } + else + { + builder.addField("Stats", (event.getClient()).getTotalGuilds() + " Servers\nShard " + (event.getJDA().getShardInfo().getShardId() + 1) + + "/" + event.getJDA().getShardInfo().getShardTotal(), true); + builder.addField("This shard", event.getJDA().getUsers().size() + " Users\n" + event.getJDA().getGuilds().size() + " Servers", true); + builder.addField("", event.getJDA().getTextChannels().size() + " Text Channels\n" + event.getJDA().getVoiceChannels().size() + " Voice Channels", true); + } + builder.setFooter("Last restart", null); + builder.setTimestamp(event.getClient().getStartTime()); + event.reply(builder.build()); + } + +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java new file mode 100644 index 00000000..1c284019 --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java @@ -0,0 +1,105 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import java.awt.Color; +import java.util.concurrent.TimeUnit; +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.doc.standard.CommandInfo; +import com.jagrosh.jdautilities.doc.standard.Error; +import com.jagrosh.jdautilities.doc.standard.RequiredPermissions; +import com.jagrosh.jdautilities.examples.doc.Author; +import com.jagrosh.jdautilities.menu.Paginator; +import com.jagrosh.jdautilities.commons.waiter.EventWaiter; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.exceptions.PermissionException; + +/** + * + * @author John Grosh (jagrosh) + */ +@CommandInfo( + name = "Guildlist", + description = "Gets a paginated list of the guilds the bot is on.", + requirements = { + "The bot has all necessary permissions.", + "The user is the bot's owner." + } +) +@Error( + value = "If arguments are provided, but they are not an integer.", + response = "[PageNumber] is not a valid integer!" +) +@RequiredPermissions({Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ADD_REACTION}) +@Author("John Grosh (jagrosh)") +public class GuildlistCommand extends Command { + + private final Paginator.Builder pbuilder; + public GuildlistCommand(EventWaiter waiter) + { + this.name = "guildlist"; + this.help = "shows the list of guilds the bot is on"; + this.arguments = "[pagenum]"; + this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_ADD_REACTION}; + this.guildOnly = false; + this.ownerCommand = true; + pbuilder = new Paginator.Builder().setColumns(1) + .setItemsPerPage(10) + .showPageNumbers(true) + .waitOnSinglePage(false) + .useNumberedItems(false) + .setFinalAction(m -> { + try { + m.clearReactions().queue(); + } catch(PermissionException ex) { + m.delete().queue(); + } + }) + .setEventWaiter(waiter) + .setTimeout(1, TimeUnit.MINUTES); + } + + @Override + protected void execute(CommandEvent event) { + int page = 1; + if(!event.getArgs().isEmpty()) + { + try + { + page = Integer.parseInt(event.getArgs()); + } + catch(NumberFormatException e) + { + event.reply(event.getClient().getError()+" `"+event.getArgs()+"` is not a valid integer!"); + return; + } + } + pbuilder.clearItems(); + event.getJDA().getGuilds().stream() + .map(g -> "**"+g.getName()+"** (ID:"+g.getId()+") ~ "+g.getMembers().size()+" Members") + .forEach(pbuilder::addItems); + Paginator p = pbuilder.setColor(event.isFromType(ChannelType.TEXT) ? event.getSelfMember().getColor() : Color.black) + .setText(event.getClient().getSuccess()+" Guilds that **"+event.getSelfUser().getName()+"** is connected to" + +(event.getJDA().getShardInfo()== JDA.ShardInfo.SINGLE ? ":" : "(Shard ID "+event.getJDA().getShardInfo().getShardId()+"):")) + .setUsers(event.getAuthor()) + .build(); + p.paginate(event.getChannel(), page); + } + +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java new file mode 100644 index 00000000..c5a25571 --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/PingCommand.java @@ -0,0 +1,51 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import java.time.temporal.ChronoUnit; +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.doc.standard.CommandInfo; +import com.jagrosh.jdautilities.examples.doc.Author; + +/** + * + * @author John Grosh (jagrosh) + */ +@CommandInfo( + name = {"Ping", "Pong"}, + description = "Checks the bot's latency" +) +@Author("John Grosh (jagrosh)") +public class PingCommand extends Command { + + public PingCommand() + { + this.name = "ping"; + this.help = "checks the bot's latency"; + this.guildOnly = false; + this.aliases = new String[]{"pong"}; + } + + @Override + protected void execute(CommandEvent event) { + event.reply("Ping: ...", m -> { + long ping = event.getMessage().getTimeCreated().until(m.getTimeCreated(), ChronoUnit.MILLIS); + m.editMessage("Ping: " + ping + "ms | Websocket: " + event.getJDA().getGatewayPing() + "ms").queue(); + }); + } + +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java new file mode 100644 index 00000000..68e28eef --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/RoleinfoCommand.java @@ -0,0 +1,118 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.commons.utils.FinderUtil; +import java.awt.Color; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Locale; + +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; + +/** + * + * @author John Grosh (jagrosh) + */ +public class RoleinfoCommand extends Command +{ + private final static String LINESTART = "\u25AB"; // ▫ + private final static String ROLE_EMOJI = "\uD83C\uDFAD"; // 🎭 + + public RoleinfoCommand() + { + this.name = "roleinfo"; + this.aliases = new String[]{"rinfo","rankinfo"}; + this.help = "shows info about a role"; + this.arguments = ""; + this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; + this.guildOnly = true; + } + + @Override + protected void execute(CommandEvent event) + { + Role role; + if(event.getArgs().isEmpty()) + { + event.replyError("Please provide the name of a role!"); + return; + } + else + { + List found = FinderUtil.findRoles(event.getArgs(), event.getGuild()); + if(found.isEmpty()) + { + event.replyError("I couldn't find the role you were looking for!"); + return; + } + else if(found.size()>1) + { + event.replyWarning(listOfRoles(found, event.getArgs())); + return; + } + else + { + role = found.get(0); + } + } + + String title = (ROLE_EMOJI + " Information about **" + role.getName() + "**:") + .replace("@everyone", "@\u0435veryone") // cyrillic e + .replace("@here", "@h\u0435re") // cyrillic e + .replace("discord.gg/", "dis\u0441ord.gg/"); // cyrillic c;; + List list = role.isPublicRole() ? event.getGuild().getMembers() : event.getGuild().getMembersWithRoles(role); + Color color = role.getColor(); + StringBuilder desr = new StringBuilder(LINESTART + "ID: **" + role.getId() + "**\n" + + LINESTART + "Creation: **" + role.getTimeCreated().format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**\n" + + LINESTART + "Position: **" + role.getPosition()+"**\n" + + LINESTART + "Color: **#" + (color==null ? "000000" : Integer.toHexString(color.getRGB()).toUpperCase(Locale.ROOT).substring(2)) + "**\n" + + LINESTART + "Mentionable: **" + role.isMentionable() + "**\n" + + LINESTART + "Hoisted: **" + role.isHoisted() + "**\n" + + LINESTART + "Managed: **" + role.isManaged() + "**\n" + + LINESTART + "Permissions: "); + if(role.getPermissions().isEmpty()) + desr.append("None"); + else + desr.append(role.getPermissions().stream().map(p -> "`, `"+p.getName()).reduce("", String::concat).substring(3)).append("`"); + desr.append("\n").append(LINESTART).append("Members: **").append(list.size()).append("**\n"); + if(list.size() * 24 <= 2048-desr.length()) + list.forEach(m -> desr.append("<@").append(m.getUser().getId()).append("> ")); + + event.reply(new MessageCreateBuilder() + .setContent(title) + .setEmbeds(new EmbedBuilder() + .setDescription(desr.toString().trim()) + .setColor(role.getColor()).build()) + .build()); + } + + private static String listOfRoles(List list, String query) + { + String out = String.format("**Multiple roles found matching \"%s\":**", query); + for(int i = 0; i < 6 && i < list.size(); i++) + out += "\n - " + list.get(i).getName() + " (ID:" + list.get(i).getId() + ")"; + if(list.size() > 6) + out += "\n**And " + (list.size() - 6) + " more...**"; + return out; + } +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java new file mode 100644 index 00000000..b7a1226f --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ServerinfoCommand.java @@ -0,0 +1,91 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import java.time.format.DateTimeFormatter; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.OnlineStatus; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; + +/** + * + * @author John Grosh (jagrosh) + */ +public class ServerinfoCommand extends Command +{ + private final static String LINESTART = "\u25AB"; // ▫ + private final static String GUILD_EMOJI = "\uD83D\uDDA5"; // 🖥 + private final static String NO_REGION = "\u2754"; // ❔ + + public ServerinfoCommand() + { + this.name = "serverinfo"; + this.aliases = new String[]{"server","guildinfo"}; + this.help = "shows server info"; + this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; + this.guildOnly = true; + } + + @Override + protected void execute(CommandEvent event) + { + Guild guild = event.getGuild(); + Member owner = guild.getOwner(); + long onlineCount = guild.getMembers().stream().filter(u -> u.getOnlineStatus() != OnlineStatus.OFFLINE).count(); + long botCount = guild.getMembers().stream().filter(m -> m.getUser().isBot()).count(); + EmbedBuilder builder = new EmbedBuilder(); + String title = (GUILD_EMOJI + " Information about **" + guild.getName() + "**:") + .replace("@everyone", "@\u0435veryone") // cyrillic e + .replace("@here", "@h\u0435re") // cyrillic e + .replace("discord.gg/", "dis\u0441ord.gg/"); // cyrillic c; + String verif; + switch(guild.getVerificationLevel()) + { + case VERY_HIGH: + verif = "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"; + break; + case HIGH: + verif = "(╯°□°)╯︵ ┻━┻"; + break; + default: + verif = guild.getVerificationLevel().name(); + break; + } + String str = LINESTART + "ID: **" + guild.getId() + "**\n" + + LINESTART + "Owner: " + (owner == null ? "Unknown" : "**" + owner.getUser().getName() + "**#" + owner.getUser().getDiscriminator()) + "\n" + + LINESTART + "Creation: **" + guild.getTimeCreated().format(DateTimeFormatter.RFC_1123_DATE_TIME) + "**\n" + + LINESTART + "Users: **" + guild.getMemberCache().size() + "** (" + onlineCount + " online, " + botCount + " bots)\n" + + LINESTART + "Channels: **" + guild.getTextChannelCache().size() + "** Text, **" + guild.getVoiceChannelCache().size() + "** Voice, **" + guild.getCategoryCache().size() + "** Categories\n" + + LINESTART + "Verification: **" + verif + "**"; + if(!guild.getFeatures().isEmpty()) + str += "\n" + LINESTART + "Features: **" + String.join("**, **", guild.getFeatures()) + "**"; + if(guild.getSplashId() != null) + { + builder.setImage(guild.getSplashUrl() + "?size=1024"); + str += "\n" + LINESTART + "Splash: "; + } + if(guild.getIconUrl()!=null) + builder.setThumbnail(guild.getIconUrl()); + builder.setColor(owner == null ? null : owner.getColor()); + builder.setDescription(str); + event.reply(new MessageCreateBuilder().setContent(title).setEmbeds(builder.build()).build()); + } +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java new file mode 100644 index 00000000..82349a3f --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/ShutdownCommand.java @@ -0,0 +1,48 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.command; + +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.doc.standard.CommandInfo; +import com.jagrosh.jdautilities.examples.doc.Author; + +/** + * + * @author John Grosh (jagrosh) + */ +@CommandInfo( + name = "Shutdown", + description = "Safely shuts down the bot." +) +@Author("John Grosh (jagrosh)") +public class ShutdownCommand extends Command { + + public ShutdownCommand() + { + this.name = "shutdown"; + this.help = "safely shuts off the bot"; + this.guildOnly = false; + this.ownerCommand = true; + } + + @Override + protected void execute(CommandEvent event) { + event.reactWarning(); + event.getJDA().shutdown(); + } + +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java new file mode 100644 index 00000000..6c64a298 --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/doc/Author.java @@ -0,0 +1,45 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jdautilities.examples.doc; + +import com.jagrosh.jdautilities.doc.ConvertedBy; +import com.jagrosh.jdautilities.doc.DocConverter; + +import java.lang.annotation.*; + +/** + * Annotation to mark a command's specific author. + * + * @since 2.0 + * @author Kaidan Gustave + */ +@ConvertedBy(Author.Converter.class) +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +public @interface Author +{ + String value(); + + class Converter implements DocConverter + { + @Override + public String read(Author annotation) + { + return String.format("**Author:** %s", annotation.value()); + } + } +} diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java new file mode 100644 index 00000000..b8128298 --- /dev/null +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/package-info.java @@ -0,0 +1,29 @@ +/* + * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Common package for all available example classes.
+ * + *

The contents of this package are summarized as follows: + *

    + *
  • {@link com.jagrosh.jdautilities.examples.command Example Commands Package} + *
    Contains all example commands.
  • + * + *
  • {@link com.jagrosh.jdautilities.examples.doc Example CommandDoc Package} + *
    Contains all example CommandDoc annotations.
  • + *
+ */ +package com.jagrosh.jdautilities.examples; From 0faad053d92f8aa66812ed49b0ca851876b0b67e Mon Sep 17 00:00:00 2001 From: ZephyrKaOne Date: Fri, 16 Sep 2022 15:43:04 +0200 Subject: [PATCH 4/6] Change JDA version 18 -> 19 --- .../jagrosh/jdautilities/command/Command.java | 4 +- .../jdautilities/command/CommandEvent.java | 46 +++++++++---------- .../jdautilities/command/CooldownScope.java | 6 +-- .../command/SlashCommandEvent.java | 2 +- .../commons/utils/FinderUtil.java | 18 ++++---- .../jagrosh/jdautilities/menu/ButtonMenu.java | 2 +- .../jdautilities/menu/EmbedPaginator.java | 4 +- .../com/jagrosh/jdautilities/menu/Menu.java | 4 +- .../jdautilities/menu/OrderedMenu.java | 6 +-- .../jagrosh/jdautilities/menu/Paginator.java | 4 +- .../jdautilities/menu/SelectionDialog.java | 4 +- .../jagrosh/jdautilities/menu/Slideshow.java | 4 +- 12 files changed, 52 insertions(+), 52 deletions(-) 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 14f710f0..63e744f2 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/Command.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/Command.java @@ -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 net.dv8tion.jda.api.entities.channel.concrete.TextChannel 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 net.dv8tion.jda.api.entities.channel.concrete.TextChannel 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 81e6de30..91dd3c24 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java @@ -43,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 net.dv8tion.jda.api.entities.channel.middleman.MessageChannel 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. @@ -134,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 net.dv8tion.jda.api.entities.channel.middleman.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}), @@ -358,7 +358,7 @@ public void reply(MessageCreateData message, Consumer success, Consumer * 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 net.dv8tion.jda.api.entities.channel.middleman.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 @@ -379,7 +379,7 @@ public void reply(File file, String filename) * 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 net.dv8tion.jda.api.entities.channel.middleman.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 @@ -447,7 +447,7 @@ public void replyOrAlternate(MessageEmbed embed, String alternateMessage) * 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 net.dv8tion.jda.api.entities.channel.middleman.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 @@ -478,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -505,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -535,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -567,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. @@ -591,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -618,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -647,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. @@ -671,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -698,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 net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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. @@ -728,7 +728,7 @@ 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. @@ -737,7 +737,7 @@ public void replyInDm(Message message, Consumer success, ConsumerThis method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)} + *

This method uses {@link net.dv8tion.jda.api.entities.channel.middleman.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 @@ -1087,7 +1087,7 @@ public User getAuthor() } /** - * Gets the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} that the CommandEvent + * Gets the {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} that the CommandEvent * was triggered on. * * @return The MessageChannel that the CommandEvent was triggered on @@ -1098,8 +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 net.dv8tion.jda.api.entities.channel.ChannelType ChannelType} of the + * {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} that the CommandEvent was triggered on. * * @return The ChannelType of the MessageChannel that this CommandEvent was triggered on */ @@ -1152,7 +1152,7 @@ public Message getMessage() } /** - * Gets the {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} that this CommandEvent + * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel 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 @@ -1174,7 +1174,7 @@ public long getResponseNumber() } /** - * Gets the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that this CommandEvent + * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel 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 @@ -1198,13 +1198,13 @@ public GuildMessageChannel getGuildChannel() } /** - * Compares a provided {@link net.dv8tion.jda.api.entities.ChannelType ChannelType} with the one this + * Compares a provided {@link net.dv8tion.jda.api.entities.channel.ChannelType 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 net.dv8tion.jda.api.entities.channel.middleman.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 *

    @@ -150,7 +150,7 @@ public enum CooldownScope * Applies this cooldown globally. * *

    As this implies: the command will be unusable on the instance of JDA in all types of - * {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}s until the cooldown has ended. + * {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}s until the cooldown has ended. * *

    The key for this is {@code |globally} */ diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java index 90ada9b6..ee662e24 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java @@ -354,7 +354,7 @@ public boolean isFromType(ChannelType channelType) } /** - * Gets the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that this CommandEvent + * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel 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 diff --git a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java index 8708199b..20393406 100644 --- a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java +++ b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java @@ -368,7 +368,7 @@ else if((name.toLowerCase(Locale.ROOT).contains(lowerquery) || effName.toLowerCa /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}s.

    + * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s.

    * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -392,7 +392,7 @@ public static List findTextChannels(String query, JDA jda) /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}s.

    + * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s.

    * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -416,7 +416,7 @@ public static List findShardTextChannels(String query, JDA jda) /** * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}s. + * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s. * *

    The following special case is applied before the standard search is done: *

      @@ -501,7 +501,7 @@ else if(name.toLowerCase(Locale.ROOT).contains(lowerquery) && startswith.isEmpty /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannel}s.

      + * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s.

      * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -522,7 +522,7 @@ public static List findVoiceChannels(String query, JDA jda) /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannel}s.

      + * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s.

      * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -543,7 +543,7 @@ public static List findShardVoiceChannels(String query, JDA jda) /** * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannel}s. + * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s. * *

      The standard search does not follow any special cases. * @@ -608,7 +608,7 @@ else if(name.toLowerCase(Locale.ROOT).contains(lowerquery) && startswith.isEmpty /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.Category Categories}.

      + * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}.

      * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -629,7 +629,7 @@ public static List findCategories(String query, JDA jda) /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.Category Categories}.

      + * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}.

      * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -650,7 +650,7 @@ public static List findShardCategories(String query, JDA jda) /** * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.Category Categories}. + * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}. * *

      The standard search does not follow any special cases. * diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java index 9e9269f8..fb30a264 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java @@ -66,7 +66,7 @@ public class ButtonMenu extends Menu /** * Shows the ButtonMenu as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * * @param channel * The MessageChannel to send the new Message to diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java index ac80efd1..6a3b745d 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java @@ -82,7 +82,7 @@ protected EmbedPaginator(EventWaiter waiter, Set users, Set roles, l /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -108,7 +108,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}, starting + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting * on whatever page number is provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java index 79bcdc03..751a399a 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java @@ -32,7 +32,7 @@ * or key-phrases. * *

      Classes extending this are able to take a provided {@link net.dv8tion.jda.api.entities.Message Message} - * or {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} and display a visualized "Menu" + * or {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} and display a visualized "Menu" * as or in it. * *

      The JDA-Utilities default implementations of this superclass typically handle input through @@ -72,7 +72,7 @@ protected Menu(EventWaiter waiter, Set users, Set roles, long timeou } /** - * Displays this Menu in a {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * Displays this Menu in a {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * * @param channel * The MessageChannel to display this Menu in diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java index e8a0f1d2..5c5695b2 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java @@ -93,7 +93,7 @@ public class OrderedMenu extends Menu /** * Shows the OrderedMenu as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -101,7 +101,7 @@ public class OrderedMenu extends Menu * @throws java.lang.IllegalArgumentException * If all of the following are violated simultaneously: *

        - *
      • Being sent to a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}.
      • + *
      • Being sent to a {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}.
      • *
      • This OrderedMenu does not allow typed input.
      • *
      • The bot doesn't have {@link net.dv8tion.jda.api.Permission#MESSAGE_ADD_REACTION * Permission.MESSAGE_ADD_REACTION} in the channel this menu is being sent to.
      • @@ -131,7 +131,7 @@ public void display(MessageChannel channel) * @throws java.lang.IllegalArgumentException * If all of the following are violated simultaneously: *
          - *
        • Being sent to a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}.
        • + *
        • Being sent to a {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}.
        • *
        • This OrderedMenu does not allow typed input.
        • *
        • The bot doesn't have {@link net.dv8tion.jda.api.Permission#MESSAGE_ADD_REACTION * Permission.MESSAGE_ADD_REACTION} in the channel this menu is being sent to.
        • diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java index 979c4d41..652f3f8f 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java @@ -109,7 +109,7 @@ public class Paginator extends Menu /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * *

          Starting on another page is available via {@link * Paginator#paginate(MessageChannel, int) @@ -142,7 +142,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}, starting + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting * on whatever page number is provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java index e7a0d59f..c7e63bcf 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java @@ -98,7 +98,7 @@ public class SelectionDialog extends Menu /** * Shows the SelectionDialog as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}, starting with + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting with * the first selection. * * @param channel @@ -125,7 +125,7 @@ public void display(Message message) /** * Shows the SelectionDialog as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}, starting with + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting with * the number selection provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java index 1ed4750e..4d8b319a 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java @@ -97,7 +97,7 @@ public class Slideshow extends Menu /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}. + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -123,7 +123,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}, starting + * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting * on whatever page number is provided. * * @param channel From 7b5044db3fb8a9a16bcda446ac1cfcfe11197bac Mon Sep 17 00:00:00 2001 From: ZephyrKaOne Date: Fri, 16 Sep 2022 15:49:51 +0200 Subject: [PATCH 5/6] Change JDA version 18 -> 19 --- .../main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java | 2 +- menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java | 2 +- menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java index 6a3b745d..f33c45d3 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java @@ -599,7 +599,7 @@ public Builder allowTextInput(boolean allowTextInput) /** * Sets the {@link com.jagrosh.jdautilities.menu.EmbedPaginator EmbedPaginator} to traverse left or right * when a provided text input is sent in the form of a Message to the - * {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel} the menu is displayed in. + * {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel GuildChannel} the menu is displayed in. * *

          If one or both these parameters are provided {@code null} this resets both of them and they will no * longer be available when the Paginator is built. diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java index 652f3f8f..8789db94 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java @@ -708,7 +708,7 @@ public Builder allowTextInput(boolean allowTextInput) /** * Sets the {@link com.jagrosh.jdautilities.menu.Paginator Paginator} to traverse * left or right when a provided text input is sent in the form of a Message to - * the {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel} the menu is displayed in. + * the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel GuildChannel} the menu is displayed in. * *

          If one or both these parameters are provided {@code null} this resets * both of them and they will no longer be available when the Paginator is built. diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java index 4d8b319a..5564ab61 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java @@ -629,7 +629,7 @@ public Builder allowTextInput(boolean allowTextInput) /** * Sets the {@link com.jagrosh.jdautilities.menu.Slideshow Slideshow} to traverse * left or right when a provided text input is sent in the form of a Message to - * the {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel} the menu is displayed in. + * the {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel GuildChannel} the menu is displayed in. * *

          If one or both these parameters are provided {@code null} this resets * both of them and they will no longer be available when the Slideshow is built. From 6dd0b00a707d687cc6bd44e0d801c854e9bc2d17 Mon Sep 17 00:00:00 2001 From: Chew Date: Fri, 16 Sep 2022 14:44:30 -0500 Subject: [PATCH 6/6] Optimize imports and comments --- .../jagrosh/jdautilities/command/Command.java | 16 ++--- .../jdautilities/command/CommandEvent.java | 59 +++++++++---------- .../command/SlashCommandEvent.java | 2 +- .../commons/utils/FinderUtil.java | 26 +++----- .../examples/command/AboutCommand.java | 8 +-- .../examples/command/GuildlistCommand.java | 7 ++- .../jagrosh/jdautilities/menu/ButtonMenu.java | 2 +- .../jdautilities/menu/EmbedPaginator.java | 4 +- .../com/jagrosh/jdautilities/menu/Menu.java | 6 +- .../jdautilities/menu/OrderedMenu.java | 24 ++++---- .../jagrosh/jdautilities/menu/Paginator.java | 22 +++---- .../jdautilities/menu/SelectionDialog.java | 24 ++++---- .../jagrosh/jdautilities/menu/Slideshow.java | 22 +++---- 13 files changed, 107 insertions(+), 115 deletions(-) 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 63e744f2..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,12 +15,6 @@ */ package com.jagrosh.jdautilities.command; -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.GuildVoiceState; @@ -28,6 +22,12 @@ 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; + /** *

          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.channel.concrete.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.channel.concrete.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 91dd3c24..3685ccc6 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/CommandEvent.java @@ -43,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.channel.middleman.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. @@ -134,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.channel.middleman.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}), @@ -357,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.channel.middleman.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 @@ -378,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.channel.middleman.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 @@ -446,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.channel.middleman.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 @@ -478,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.channel.concrete.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. @@ -505,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.channel.concrete.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. @@ -535,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.channel.concrete.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. @@ -567,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. @@ -591,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.channel.concrete.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. @@ -618,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.channel.concrete.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. @@ -647,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. @@ -671,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.channel.concrete.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. @@ -698,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.channel.concrete.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. @@ -728,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.channel.middleman.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 @@ -1087,7 +1087,7 @@ public User getAuthor() } /** - * Gets the {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} that the CommandEvent + * Gets the {@link MessageChannel} that the CommandEvent * was triggered on. * * @return The MessageChannel that the CommandEvent was triggered on @@ -1098,9 +1098,8 @@ public MessageChannel getChannel() } /** - * Gets the {@link net.dv8tion.jda.api.entities.channel.ChannelType ChannelType} of the - * {@link net.dv8tion.jda.api.entities.channel.middleman.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() @@ -1152,7 +1151,7 @@ public Message getMessage() } /** - * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.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 @@ -1174,7 +1173,7 @@ public long getResponseNumber() } /** - * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.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 @@ -1198,13 +1197,13 @@ public GuildMessageChannel getGuildChannel() } /** - * Compares a provided {@link net.dv8tion.jda.api.entities.channel.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.channel.middleman.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/SlashCommandEvent.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java index ee662e24..a3a116f6 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommandEvent.java @@ -354,7 +354,7 @@ public boolean isFromType(ChannelType channelType) } /** - * Gets the {@link net.dv8tion.jda.api.entities.channel.concrete.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 diff --git a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java index 20393406..c29c72e3 100644 --- a/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java +++ b/commons/src/main/java/com/jagrosh/jdautilities/commons/utils/FinderUtil.java @@ -368,7 +368,7 @@ else if((name.toLowerCase(Locale.ROOT).contains(lowerquery) || effName.toLowerCa /** * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s.

          + * {@link TextChannel}s.

          * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -391,8 +391,7 @@ public static List findTextChannels(String query, JDA jda) } /** - * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s.

          + * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for {@link TextChannel}s.

          * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -415,8 +414,7 @@ public static List findShardTextChannels(String query, JDA jda) } /** - * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}s. + * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for {@link TextChannel}s. * *

          The following special case is applied before the standard search is done: *

            @@ -500,8 +498,7 @@ else if(name.toLowerCase(Locale.ROOT).contains(lowerquery) && startswith.isEmpty } /** - * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s.

            + * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for {@link VoiceChannel}s.

            * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -521,8 +518,7 @@ public static List findVoiceChannels(String query, JDA jda) } /** - * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s.

            + * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for {@link VoiceChannel}s.

            * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -542,8 +538,7 @@ public static List findShardVoiceChannels(String query, JDA jda) } /** - * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel VoiceChannel}s. + * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for {@link VoiceChannel}s. * *

            The standard search does not follow any special cases. * @@ -607,8 +602,7 @@ else if(name.toLowerCase(Locale.ROOT).contains(lowerquery) && startswith.isEmpty } /** - * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}.

            + * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for {@link Category Categories}.

            * * If a {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available this will query across that * instead of the JDA instance. @@ -628,8 +622,7 @@ public static List findCategories(String query, JDA jda) } /** - * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}.

            + * Queries a provided instance of {@link net.dv8tion.jda.api.JDA JDA} for {@link Category Categories}.

            * * This only queries the instance of JDA, regardless of whether or not a * {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} is available. @@ -649,8 +642,7 @@ public static List findShardCategories(String query, JDA jda) } /** - * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for - * {@link net.dv8tion.jda.api.entities.channel.concrete.Category Categories}. + * Queries a provided {@link net.dv8tion.jda.api.entities.Guild Guild} for {@link Category Categories}. * *

            The standard search does not follow any special cases. * diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java index 9c82b108..16f49294 100644 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/AboutCommand.java @@ -15,21 +15,21 @@ */ package com.jagrosh.jdautilities.examples.command; -import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo; import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.commons.JDAUtilitiesInfo; import com.jagrosh.jdautilities.doc.standard.CommandInfo; import com.jagrosh.jdautilities.examples.doc.Author; -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.ApplicationInfo; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDAInfo; import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.ApplicationInfo; import net.dv8tion.jda.api.entities.channel.ChannelType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.awt.*; +import java.awt.Color; /** * diff --git a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java index 1c284019..09ac5948 100644 --- a/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java +++ b/examples/src/main/java/com/jagrosh/jdautilities/examples/command/GuildlistCommand.java @@ -15,21 +15,22 @@ */ package com.jagrosh.jdautilities.examples.command; -import java.awt.Color; -import java.util.concurrent.TimeUnit; import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.CommandEvent; +import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import com.jagrosh.jdautilities.doc.standard.CommandInfo; import com.jagrosh.jdautilities.doc.standard.Error; import com.jagrosh.jdautilities.doc.standard.RequiredPermissions; import com.jagrosh.jdautilities.examples.doc.Author; import com.jagrosh.jdautilities.menu.Paginator; -import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.exceptions.PermissionException; +import java.awt.Color; +import java.util.concurrent.TimeUnit; + /** * * @author John Grosh (jagrosh) diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java index fb30a264..aad52ca7 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/ButtonMenu.java @@ -66,7 +66,7 @@ public class ButtonMenu extends Menu /** * Shows the ButtonMenu as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. + * in the provided {@link MessageChannel}. * * @param channel * The MessageChannel to send the new Message to diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java index f33c45d3..92401197 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/EmbedPaginator.java @@ -82,7 +82,7 @@ protected EmbedPaginator(EventWaiter waiter, Set users, Set roles, l /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. + * in the provided {@link MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -108,7 +108,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting + * in the provided {@link MessageChannel}, starting * on whatever page number is provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java index 751a399a..efab9d0d 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Menu.java @@ -32,7 +32,7 @@ * or key-phrases. * *

            Classes extending this are able to take a provided {@link net.dv8tion.jda.api.entities.Message Message} - * or {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel} and display a visualized "Menu" + * or {@link MessageChannel} and display a visualized "Menu" * as or in it. * *

            The JDA-Utilities default implementations of this superclass typically handle input through @@ -72,8 +72,8 @@ protected Menu(EventWaiter waiter, Set users, Set roles, long timeou } /** - * Displays this Menu in a {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. - * + * Displays this Menu in a {@link MessageChannel}. + * * @param channel * The MessageChannel to display this Menu in */ diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java index 5c5695b2..ef4080a8 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/OrderedMenu.java @@ -15,15 +15,6 @@ */ package com.jagrosh.jdautilities.menu; -import java.awt.Color; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.BiConsumer; -import java.util.function.Consumer; - import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; @@ -44,6 +35,15 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData; import net.dv8tion.jda.internal.utils.Checks; +import java.awt.Color; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + /** * A {@link com.jagrosh.jdautilities.menu.Menu Menu} of ordered buttons signified * by numbers or letters, each with a reaction linked to it for users to click. @@ -93,7 +93,7 @@ public class OrderedMenu extends Menu /** * Shows the OrderedMenu as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. + * in the provided {@link MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -101,7 +101,7 @@ public class OrderedMenu extends Menu * @throws java.lang.IllegalArgumentException * If all of the following are violated simultaneously: *

              - *
            • Being sent to a {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}.
            • + *
            • Being sent to a {@link TextChannel}.
            • *
            • This OrderedMenu does not allow typed input.
            • *
            • The bot doesn't have {@link net.dv8tion.jda.api.Permission#MESSAGE_ADD_REACTION * Permission.MESSAGE_ADD_REACTION} in the channel this menu is being sent to.
            • @@ -131,7 +131,7 @@ public void display(MessageChannel channel) * @throws java.lang.IllegalArgumentException * If all of the following are violated simultaneously: *
                - *
              • Being sent to a {@link net.dv8tion.jda.api.entities.channel.concrete.TextChannel TextChannel}.
              • + *
              • Being sent to a {@link TextChannel}.
              • *
              • This OrderedMenu does not allow typed input.
              • *
              • The bot doesn't have {@link net.dv8tion.jda.api.Permission#MESSAGE_ADD_REACTION * Permission.MESSAGE_ADD_REACTION} in the channel this menu is being sent to.
              • diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java index 8789db94..f0356d25 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Paginator.java @@ -15,15 +15,6 @@ */ package com.jagrosh.jdautilities.menu; -import java.awt.Color; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.BiFunction; -import java.util.function.Consumer; - import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -41,6 +32,15 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData; import net.dv8tion.jda.internal.utils.Checks; +import java.awt.Color; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.BiFunction; +import java.util.function.Consumer; + /** * A {@link com.jagrosh.jdautilities.menu.Menu Menu} implementation that paginates a * set of one or more text items across one or more pages. @@ -109,7 +109,7 @@ public class Paginator extends Menu /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. + * in the provided {@link MessageChannel}. * *

                Starting on another page is available via {@link * Paginator#paginate(MessageChannel, int) @@ -142,7 +142,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting + * in the provided {@link MessageChannel}, starting * on whatever page number is provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java index c7e63bcf..c63f037c 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/SelectionDialog.java @@ -15,16 +15,6 @@ */ package com.jagrosh.jdautilities.menu; -import java.awt.Color; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import java.util.function.Function; - import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -40,6 +30,16 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData; import net.dv8tion.jda.internal.utils.Checks; +import java.awt.Color; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; + /** * A {@link com.jagrosh.jdautilities.menu.Menu Menu} implementation that creates * a listed display of text choices horizontally that users can scroll through @@ -98,7 +98,7 @@ public class SelectionDialog extends Menu /** * Shows the SelectionDialog as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting with + * in the provided {@link MessageChannel}, starting with * the first selection. * * @param channel @@ -125,7 +125,7 @@ public void display(Message message) /** * Shows the SelectionDialog as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting with + * in the provided {@link MessageChannel}, starting with * the number selection provided. * * @param channel diff --git a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java index 5564ab61..38a5b3ca 100644 --- a/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java +++ b/menu/src/main/java/com/jagrosh/jdautilities/menu/Slideshow.java @@ -15,15 +15,6 @@ */ package com.jagrosh.jdautilities.menu; -import java.awt.Color; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.BiFunction; -import java.util.function.Consumer; - import com.jagrosh.jdautilities.commons.waiter.EventWaiter; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -41,6 +32,15 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData; import net.dv8tion.jda.internal.utils.Checks; +import java.awt.Color; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.BiFunction; +import java.util.function.Consumer; + /** * A {@link com.jagrosh.jdautilities.menu.Menu Menu} implementation, nearly identical * to {@link com.jagrosh.jdautilities.menu.Paginator Paginator}, that displays an @@ -97,7 +97,7 @@ public class Slideshow extends Menu /** * Begins pagination on page 1 as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}. + * in the provided {@link MessageChannel}. * * @param channel * The MessageChannel to send the new Message to @@ -123,7 +123,7 @@ public void display(Message message) /** * Begins pagination as a new {@link net.dv8tion.jda.api.entities.Message Message} - * in the provided {@link net.dv8tion.jda.api.entities.channel.middleman.MessageChannel MessageChannel}, starting + * in the provided {@link MessageChannel}, starting * on whatever page number is provided. * * @param channel