Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JDA 5.0.0-alpha.19 #77

Merged
merged 6 commits into from
Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
*/
package com.jagrosh.jdautilities.command;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.GuildVoiceState;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel;

import java.util.Arrays;
import java.util.Locale;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Predicate;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.AudioChannel;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.entities.GuildVoiceState;
import net.dv8tion.jda.api.entities.TextChannel;


/**
* <h2><b>Commands In JDA-Utilities</b></h2>
Expand Down Expand Up @@ -99,7 +99,7 @@ public abstract class Command extends Interaction

/**
* {@code true} if the command may only be used in an NSFW
* {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} or DMs.
* {@link TextChannel} or DMs.
* {@code false} if it may be used anywhere
* <br>Default: {@code false}
*/
Expand Down Expand Up @@ -339,7 +339,7 @@ public boolean isCommandFor(String input)
}

/**
* Checks whether a command is allowed in a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}
* Checks whether a command is allowed in a {@link TextChannel}
* by searching the channel topic for topic tags relating to the command.
*
* <p>{-{@link com.jagrosh.jdautilities.command.Command#name name}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +43,7 @@
* development. There are also "extension" methods for all methods found in MessageReceivedEvent.
*
* <p>Methods with "reply" in their name can be used to instantly send a {@link net.dv8tion.jda.api.entities.Message Message}
* response to the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} the MessageReceivedEvent was in.
* response to the {@link MessageChannel} the MessageReceivedEvent was in.
* <br>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.
Expand Down Expand Up @@ -129,7 +134,7 @@ public CommandClient getClient()
* contained by this CommandEvent.
*
* <p>This method is exposed for those who wish to use linked deletion but may require usage of
* {@link net.dv8tion.jda.api.entities.MessageChannel#sendMessage(MessageCreateData) MessageChannel#sendMessage()}
* {@link MessageChannel#sendMessage(MessageCreateData) MessageChannel#sendMessage()}
* or for other reasons cannot use the standard {@code reply()} methods.
*
* <p>If the Message provided is <b>not</b> from the bot (IE: {@link net.dv8tion.jda.api.entities.SelfUser SelfUser}),
Expand Down Expand Up @@ -352,8 +357,8 @@ public void reply(MessageCreateData message, Consumer<Message> success, Consumer
* <p>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()}.
*
* <p>This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)}
*
* <p>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
Expand All @@ -373,8 +378,8 @@ public void reply(File file, String filename)
* <p>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()}.
*
* <p>This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)}
*
* <p>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
Expand Down Expand Up @@ -441,8 +446,8 @@ public void replyOrAlternate(MessageEmbed embed, String alternateMessage)
* <p>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()}.
*
* <p>This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)}
*
* <p>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.
*
* <p><b>NOTE:</b> This alternate String message can exceed the 2000 character cap, and will
Expand Down Expand Up @@ -473,7 +478,7 @@ public void replyOrAlternate(String message, File file, String filename, String

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

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

/**
* Replies with a String message sent to the calling {@link net.dv8tion.jda.api.entities.User User}'s
* {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}.
* {@link PrivateChannel}.
*
* <p>If the User to be Direct Messaged does not already have a PrivateChannel
* open to send messages to, this method will automatically open one.
Expand Down Expand Up @@ -562,7 +567,7 @@ public void replyInDm(String message, Consumer<Message> success, Consumer<Throwa

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

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

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

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

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

/**
* Replies with a {@link net.dv8tion.jda.api.entities.Message Message} sent to the
* calling {@link net.dv8tion.jda.api.entities.User User}'s {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}.
* calling {@link net.dv8tion.jda.api.entities.User User}'s {@link PrivateChannel}.
*
* <p>If the User to be Direct Messaged does not already have a PrivateChannel
* open to send messages to, this method will automatically open one.
Expand Down Expand Up @@ -723,16 +728,16 @@ public void replyInDm(Message message, Consumer<Message> success, Consumer<Throw
/**
* Replies with a String message and a {@link java.io.File} with the provided name, or a default
* name if left null, and sent to the calling {@link net.dv8tion.jda.api.entities.User User}'s
* {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}.
*
* {@link PrivateChannel}.
*
* <p>If the User to be Direct Messaged does not already have a PrivateChannel
* open to send messages to, this method will automatically open one.
*
* <p>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()}.
*
* <p>This method uses {@link net.dv8tion.jda.api.entities.MessageChannel#sendFiles(FileUpload...) MessageChannel#sendFile(FileUpload...)}
*
* <p>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
Expand Down Expand Up @@ -1082,7 +1087,7 @@ public User getAuthor()
}

/**
* Gets the {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} that the CommandEvent
* Gets the {@link MessageChannel} that the CommandEvent
* was triggered on.
*
* @return The MessageChannel that the CommandEvent was triggered on
Expand All @@ -1093,9 +1098,8 @@ public MessageChannel getChannel()
}

/**
* Gets the {@link net.dv8tion.jda.api.entities.ChannelType ChannelType} of the
* {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} that the CommandEvent was triggered on.
*
* Gets the {@link ChannelType} of the {@link MessageChannel} that the CommandEvent was triggered on.
*
* @return The ChannelType of the MessageChannel that this CommandEvent was triggered on
*/
public ChannelType getChannelType()
Expand Down Expand Up @@ -1147,7 +1151,7 @@ public Message getMessage()
}

/**
* Gets the {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} that this CommandEvent
* Gets the {@link PrivateChannel} that this CommandEvent
* may have taken place on, or {@code null} if it didn't happen on a PrivateChannel.
*
* @return The PrivateChannel that this CommandEvent may have taken place on, or null
Expand All @@ -1169,7 +1173,7 @@ public long getResponseNumber()
}

/**
* Gets the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that this CommandEvent
* Gets the {@link TextChannel} that this CommandEvent
* may have taken place on, or {@code null} if it didn't happen on a TextChannel.
*
* @return The TextChannel this CommandEvent may have taken place on, or null
Expand All @@ -1193,13 +1197,13 @@ public GuildMessageChannel getGuildChannel()
}

/**
* Compares a provided {@link net.dv8tion.jda.api.entities.ChannelType ChannelType} with the one this
* Compares a provided {@link ChannelType} with the one this
* CommandEvent occurred on, returning {@code true} if they are the same ChannelType.
*
* @param channelType
* The ChannelType to compare
*
* @return {@code true} if the CommandEvent originated from a {@link net.dv8tion.jda.api.entities.MessageChannel}
*
* @return {@code true} if the CommandEvent originated from a {@link MessageChannel}
* of the provided ChannelType, otherwise {@code false}.
*/
public boolean isFromType(ChannelType channelType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>The key for this is generated in the format
Expand All @@ -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.
*
* <p>The key for this is generated in the format
* <ul>
Expand Down Expand Up @@ -150,7 +150,7 @@ public enum CooldownScope
* Applies this cooldown globally.
*
* <p>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.
*
* <p>The key for this is {@code <command-name>|globally}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading