aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-06-10 15:28:35 -0700
committerPinapelz <donaldshan1@outlook.com>2023-06-10 15:28:35 -0700
commit18c0081c6d41345c00bf1f6ddb245ed69efea9c3 (patch)
treef76d9e1fa8d402c63a6904dcf13a0bdf30c156cf
parentf17589fe41f03b61468e19fbf55d092ce8b45146 (diff)
Bump JDA from v4.4 to V5
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/commands/CommandManager.java6
-rw-r--r--src/main/java/commands/StatusHandler.java37
3 files changed, 25 insertions, 20 deletions
diff --git a/pom.xml b/pom.xml
index 0ee4a9c..384181e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
- <version>4.4.0_350</version>
+ <version>5.0.0-beta.6</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
diff --git a/src/main/java/commands/CommandManager.java b/src/main/java/commands/CommandManager.java
index ac54131..d82033e 100644
--- a/src/main/java/commands/CommandManager.java
+++ b/src/main/java/commands/CommandManager.java
@@ -3,7 +3,7 @@ package commands;
import builders.ScheduleMessageBuilder;
import fileutils.UpcomingChannelsManager;
import net.dv8tion.jda.api.entities.MessageEmbed;
-import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
+import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import vtuber.ScheduleHandler;
@@ -22,7 +22,7 @@ public class CommandManager extends ListenerAdapter {
System.out.println("CommandManager initialized");
}
@Override
- public void onSlashCommand(SlashCommandEvent e) {
+ public void onSlashCommandInteraction(SlashCommandInteractionEvent e) {
String command = e.getName();
MessageEmbed scheduleMessage;
switch (command) {
@@ -114,7 +114,7 @@ public class CommandManager extends ListenerAdapter {
return true;
}
- public boolean hasPermission(SlashCommandEvent e){
+ public boolean hasPermission(SlashCommandInteractionEvent e){
if (e.getMember().isOwner() || e.getMember().getRoles().contains(e.getGuild().getRoleById(adminRole))){
return true;
}
diff --git a/src/main/java/commands/StatusHandler.java b/src/main/java/commands/StatusHandler.java
index 99ebc0c..274f9aa 100644
--- a/src/main/java/commands/StatusHandler.java
+++ b/src/main/java/commands/StatusHandler.java
@@ -2,9 +2,10 @@ package commands;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.interactions.commands.OptionType;
-import net.dv8tion.jda.api.interactions.commands.build.CommandData;
+import net.dv8tion.jda.api.interactions.commands.build.Commands;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
+
public class StatusHandler {
JDA jda;
@@ -15,24 +16,28 @@ public class StatusHandler {
public void updateSlashCommands() {
System.out.println("Adding slash commands");
- jda.upsertCommand(new CommandData("schedule", "Shows upcoming streams and events for a given organization")
+ jda.updateCommands().addCommands(
+ Commands.slash("schedule", "Shows upcoming streams and events for a given organization")
.addOption(OptionType.STRING, "organization",
"Holodex Organization Name (e.g Hololive, Nijisanji, Phase Connect, PRISM, Production Kawaii)",
true))
- .queue();
- jda.upsertCommand(new CommandData("schedule-channel", "Shows upcoming streams and events for a given channel ID")
- .addOption(OptionType.STRING, "channel-id",
- "YouTube Channel ID (e.g UCp6993wxpyDPHUpavwDFqgg)",
- true))
- .queue();
- jda.upsertCommand(new CommandData("configure", "Sets channel to be updated with live and upcoming streams for the organization provided")
- .addOptions(new OptionData(OptionType.STRING, "type", "Individual Channel or Organization", true)
- .addChoice("Channel", "channel")
- .addChoice("Organization", "org"))
- .addOption(OptionType.STRING, "id", "The name of the organization or the channel ID", true))
- .queue();
- jda.upsertCommand(new CommandData("remove-config", "Removes the configuration for the channel this command is run in")
- .addOption(OptionType.STRING, "term", "The channel ID or Organization")).queue();
+ .addCommands(
+ Commands.slash("schedule-channel", "Shows upcoming streams and events for a given channel ID")
+ .addOption(OptionType.STRING, "channel-id",
+ "YouTube Channel ID (e.g UCp6993wxpyDPHUpavwDFqgg)",
+ true))
+ .addCommands(
+ Commands.slash("configure", "Sets channel to be updated with live and upcoming streams for the organization provided")
+ .addOptions(new OptionData(OptionType.STRING, "type", "Individual Channel or Organization")
+ .addChoice("Channel", "channel")
+ .addChoice("Organization", "org"))
+ .addOption(OptionType.STRING, "id", "The name of the organization or the channel ID", true))
+ .addCommands(
+ Commands.slash("remove-config", "Removes the configuration for the channel this command is run in")
+ .addOption(OptionType.STRING, "term", "The channel ID or Organization")).queue();
+
+
+
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage