aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/commands')
-rw-r--r--src/main/java/commands/CommandManager.java6
-rw-r--r--src/main/java/commands/StatusHandler.java37
2 files changed, 24 insertions, 19 deletions
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..0c19333 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", true)
+ .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