Skip to content

Commit 0e95bcf

Browse files
Merge pull request #265 from Java-Discord/dynxsty/jda_alpha_10
Bumped JDA to latest version `(5492a76)`
2 parents b291311 + 252531d commit 0e95bcf

File tree

9 files changed

+15
-19
lines changed

9 files changed

+15
-19
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies {
2020
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
2121
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
2222

23-
implementation 'com.github.Xirado:JDA:6adee1ec24'
23+
implementation 'com.github.DV8FromTheWorld:JDA:5492a76bce'
2424
implementation 'com.google.code.gson:gson:2.9.0'
2525
implementation 'org.yaml:snakeyaml:1.29'
2626
implementation 'com.google.re2j:re2j:1.6'

src/main/java/net/javadiscord/javabot/command/DelegatingCommandHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.javadiscord.javabot.command;
22

33
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
4-
import net.dv8tion.jda.api.interactions.InteractionHook;
54
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
65
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
76
import net.javadiscord.javabot.command.interfaces.SlashCommand;
@@ -93,7 +92,7 @@ protected void addSubcommandGroup(String name, SlashCommand handler) {
9392
* @return The reply action that is sent to the user.
9493
*/
9594
@Override
96-
public InteractionCallbackAction<InteractionHook> handleSlashCommandInteraction(SlashCommandInteractionEvent event) throws ResponseException {
95+
public InteractionCallbackAction<?> handleSlashCommandInteraction(SlashCommandInteractionEvent event) throws ResponseException {
9796
// First we check if the event has specified a subcommand group, and if we have a group handler for it.
9897
if (event.getSubcommandGroup() != null) {
9998
SlashCommand groupHandler = this.getSubcommandGroupHandlers().get(event.getSubcommandGroup());
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package net.javadiscord.javabot.command.interfaces;
22

33
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
4-
import net.dv8tion.jda.api.interactions.InteractionHook;
54
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
65
import net.javadiscord.javabot.command.ResponseException;
76

87
/**
98
* Interface that handles Discord's Message Context Commands.
109
*/
1110
public interface MessageContextCommand {
12-
InteractionCallbackAction<InteractionHook> handleMessageContextCommandInteraction(MessageContextInteractionEvent event) throws ResponseException;
11+
InteractionCallbackAction<?> handleMessageContextCommandInteraction(MessageContextInteractionEvent event) throws ResponseException;
1312
}

src/main/java/net/javadiscord/javabot/command/interfaces/SlashCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.javadiscord.javabot.command.interfaces;
22

33
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
4-
import net.dv8tion.jda.api.interactions.InteractionHook;
54
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
65
import net.javadiscord.javabot.command.ResponseException;
76

@@ -21,5 +20,5 @@
2120
* </p>
2221
*/
2322
public interface SlashCommand {
24-
InteractionCallbackAction<InteractionHook> handleSlashCommandInteraction(SlashCommandInteractionEvent event) throws ResponseException;
23+
InteractionCallbackAction<?> handleSlashCommandInteraction(SlashCommandInteractionEvent event) throws ResponseException;
2524
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package net.javadiscord.javabot.command.interfaces;
22

33
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent;
4-
import net.dv8tion.jda.api.interactions.InteractionHook;
54
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
65
import net.javadiscord.javabot.command.ResponseException;
76

87
/**
98
* Interface that handles Discord's User Context Commands.
109
*/
1110
public interface UserContextCommand {
12-
InteractionCallbackAction<InteractionHook> handleUserContextCommandInteraction(UserContextInteractionEvent event) throws ResponseException;
11+
InteractionCallbackAction<?> handleUserContextCommandInteraction(UserContextInteractionEvent event) throws ResponseException;
1312
}

src/main/java/net/javadiscord/javabot/systems/commands/FormatCodeCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
77
import net.dv8tion.jda.api.interactions.components.ActionRow;
88
import net.dv8tion.jda.api.interactions.components.buttons.Button;
9+
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
910
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
1011
import net.javadiscord.javabot.command.Responses;
1112
import net.javadiscord.javabot.command.interfaces.MessageContextCommand;
@@ -55,7 +56,7 @@ public ReplyCallbackAction handleSlashCommandInteraction(SlashCommandInteraction
5556
}
5657

5758
@Override
58-
public ReplyCallbackAction handleMessageContextCommandInteraction(MessageContextInteractionEvent event) {
59+
public InteractionCallbackAction<?> handleMessageContextCommandInteraction(MessageContextInteractionEvent event) {
5960
return event.replyFormat("```java\n%s\n```", StringUtils.standardSanitizer().compute(event.getTarget().getContentRaw()))
6061
.allowedMentions(List.of())
6162
.addActionRows(this.buildActionRow(event.getTarget()));

src/main/java/net/javadiscord/javabot/systems/moderation/ReportCommand.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
1919
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
2020
import net.javadiscord.javabot.Bot;
21-
import net.javadiscord.javabot.command.ResponseException;
2221
import net.javadiscord.javabot.command.Responses;
2322
import net.javadiscord.javabot.command.interfaces.MessageContextCommand;
2423
import net.javadiscord.javabot.command.interfaces.UserContextCommand;
@@ -50,7 +49,7 @@ private Modal buildUserReportModal(UserContextInteractionEvent event) {
5049
.setMaxLength(MessageEmbed.VALUE_MAX_LENGTH)
5150
.build();
5251
String title = "Report " + event.getTarget().getAsTag();
53-
return Modal.create("report:user:" + event.getTarget().getId(), title.substring(0, Math.min(title.length(), Modal.TITLE_MAX_LENGTH)))
52+
return Modal.create("report:user:" + event.getTarget().getId(), title.substring(0, Math.min(title.length(), Modal.MAX_TITLE_LENGTH)))
5453
.addActionRows(ActionRow.of(messageInput))
5554
.build();
5655
}
@@ -71,7 +70,7 @@ private Modal buildMessageReportModal(MessageContextInteractionEvent event) {
7170
TextInput messageInput = TextInput.create(REASON_OPTION_NAME, "Report Description", TextInputStyle.PARAGRAPH)
7271
.setMaxLength(MessageEmbed.VALUE_MAX_LENGTH)
7372
.build();
74-
return Modal.create("report:message:" + event.getTarget().getId(), title.substring(0, Math.min(title.length(), Modal.TITLE_MAX_LENGTH)))
73+
return Modal.create("report:message:" + event.getTarget().getId(), title.substring(0, Math.min(title.length(), Modal.MAX_TITLE_LENGTH)))
7574
.addActionRows(ActionRow.of(messageInput))
7675
.build();
7776
}
@@ -188,23 +187,23 @@ private EmbedBuilder buildReportEmbed(User reported, String reason, User reporte
188187
}
189188

190189
@Override
191-
public InteractionCallbackAction<InteractionHook> handleMessageContextCommandInteraction(MessageContextInteractionEvent event) throws ResponseException {
190+
public InteractionCallbackAction<?> handleMessageContextCommandInteraction(MessageContextInteractionEvent event) {
192191
if (event.getTarget().getAuthor().equals(event.getUser())) {
193192
return Responses.error(event, "You cannot perform this action on yourself.");
194193
}
195194
return event.replyModal(this.buildMessageReportModal(event));
196195
}
197196

198197
@Override
199-
public InteractionCallbackAction<InteractionHook> handleUserContextCommandInteraction(UserContextInteractionEvent event) throws ResponseException {
198+
public InteractionCallbackAction<?> handleUserContextCommandInteraction(UserContextInteractionEvent event) {
200199
if (event.getTarget().equals(event.getUser())) {
201200
return Responses.error(event, "You cannot perform this action on yourself.");
202201
}
203202
return event.replyModal(this.buildUserReportModal(event));
204203
}
205204

206205
@Override
207-
protected ReplyCallbackAction handleModerationActionCommand(SlashCommandInteractionEvent event, Member commandUser, Member target) throws ResponseException {
206+
protected ReplyCallbackAction handleModerationActionCommand(SlashCommandInteractionEvent event, Member commandUser, Member target) {
208207
this.handleUserReport(event.getHook(), event.getOption("reason", "N/A", OptionMapping::getAsString), commandUser.getUser(), target.getId());
209208
return event.deferReply(true);
210209
}

src/main/java/net/javadiscord/javabot/systems/moderation/warn/WarnsCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
77
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent;
88
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
9+
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
910
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
1011
import net.javadiscord.javabot.Bot;
1112
import net.javadiscord.javabot.command.ResponseException;
@@ -39,7 +40,7 @@ public ReplyCallbackAction handleSlashCommandInteraction(SlashCommandInteraction
3940
}
4041

4142
@Override
42-
public ReplyCallbackAction handleUserContextCommandInteraction(UserContextInteractionEvent event) throws ResponseException {
43+
public InteractionCallbackAction<?> handleUserContextCommandInteraction(UserContextInteractionEvent event) throws ResponseException {
4344
LocalDateTime cutoff = LocalDateTime.now().minusDays(Bot.config.get(event.getGuild()).getModeration().getWarnTimeoutDays());
4445
Member member = event.getTargetMember();
4546
try (var con = Bot.dataSource.getConnection()) {

src/main/java/net/javadiscord/javabot/systems/staff/self_roles/SelfRoleCommandHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.javadiscord.javabot.systems.staff.self_roles;
22

33
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
4-
import net.dv8tion.jda.api.interactions.InteractionHook;
54
import net.dv8tion.jda.api.requests.restaction.interactions.InteractionCallbackAction;
65
import net.javadiscord.javabot.command.DelegatingCommandHandler;
76
import net.javadiscord.javabot.command.ResponseException;
@@ -24,7 +23,7 @@ public SelfRoleCommandHandler() {
2423
}
2524

2625
@Override
27-
public InteractionCallbackAction<InteractionHook> handleSlashCommandInteraction(SlashCommandInteractionEvent event) {
26+
public InteractionCallbackAction<?> handleSlashCommandInteraction(SlashCommandInteractionEvent event) {
2827
try {
2928
return super.handleSlashCommandInteraction(event);
3029
} catch(ResponseException e) {

0 commit comments

Comments
 (0)