Skip to content

Commit 20faa33

Browse files
committed
update to jda 5.3.0 and add installation contexts
1 parent 948d4ea commit 20faa33

File tree

9 files changed

+19
-10
lines changed

9 files changed

+19
-10
lines changed

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ repositories {
1919
}
2020

2121
dependencies {
22-
implementation("net.dv8tion", "JDA", "5.2.0")
23-
implementation("pw.chew", "jda-chewtils", "2.0")
24-
implementation("org.json", "json", "20240303")
22+
implementation("net.dv8tion", "JDA", "5.3.0")
23+
implementation("pw.chew", "jda-chewtils", "2.1")
24+
implementation("org.json", "json", "20250107")
2525
implementation("ch.qos.logback", "logback-classic", "1.5.6")
2626
implementation("mysql", "mysql-connector-java", "8.0.33")
2727
implementation("org.mapdb", "mapdb", "3.1.0")

src/main/java/pw/chew/mlb/commands/ConfigCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.dv8tion.jda.api.entities.Guild;
88
import net.dv8tion.jda.api.entities.MessageEmbed;
99
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
10+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1011
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1112
import net.dv8tion.jda.api.interactions.commands.OptionType;
1213
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
@@ -24,6 +25,7 @@ public ConfigCommand() {
2425
this.name = "config";
2526
this.help = "Configure MLB Bot";
2627
this.userPermissions = new Permission[]{Permission.MANAGE_CHANNEL};
28+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
2729
this.children = new SlashCommand[]{
2830
new ConfigChannelSubcommand(), // Channel
2931
new ConfigServerSubcommand() // Server

src/main/java/pw/chew/mlb/commands/GameInfoCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
88
import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteractionCreateEvent;
99
import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent;
10+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1011
import net.dv8tion.jda.api.interactions.commands.OptionType;
1112
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
1213
import net.dv8tion.jda.api.interactions.components.ActionRow;
@@ -42,7 +43,7 @@ public class GameInfoCommand extends SlashCommand {
4243
public GameInfoCommand() {
4344
this.name = "gameinfo";
4445
this.help = "Get information about a specific game";
45-
this.guildOnly = false;
46+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD, InteractionContextType.BOT_DM, InteractionContextType.PRIVATE_CHANNEL};
4647

4748
this.options = Collections.singletonList(
4849
new OptionData(OptionType.STRING, "game", "Pick a game from today to view info for.", true, true)

src/main/java/pw/chew/mlb/commands/PlanGameCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
1111
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
1212
import net.dv8tion.jda.api.interactions.DiscordLocale;
13+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1314
import net.dv8tion.jda.api.interactions.InteractionHook;
1415
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1516
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -33,6 +34,7 @@ public class PlanGameCommand extends SlashCommand {
3334
public PlanGameCommand() {
3435
this.name = "plangame";
3536
this.help = "Plans a game to be played. Makes a thread in text channels or a post in forum channels.";
37+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
3638
this.descriptionLocalization = Map.of(
3739
DiscordLocale.ENGLISH_US, "Plans a game to be played. Makes a thread in text channels or a post in forum channels.",
3840
DiscordLocale.SPANISH, "Planifica un juego para ser jugado."

src/main/java/pw/chew/mlb/commands/ScoreCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.jagrosh.jdautilities.command.SlashCommand;
44
import com.jagrosh.jdautilities.command.SlashCommandEvent;
55
import net.dv8tion.jda.api.interactions.DiscordLocale;
6+
import net.dv8tion.jda.api.interactions.InteractionContextType;
67
import net.dv8tion.jda.api.interactions.components.buttons.Button;
78
import net.dv8tion.jda.internal.utils.Checks;
89
import pw.chew.mlb.listeners.GameFeedHandler;
@@ -15,6 +16,7 @@ public class ScoreCommand extends SlashCommand {
1516
public ScoreCommand() {
1617
this.name = "score";
1718
this.help = "Shows the score and match-ups of the current game";
19+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
1820
this.descriptionLocalization = Map.of(
1921
DiscordLocale.ENGLISH_US, "Shows the score and match-ups of the current game",
2022
DiscordLocale.SPANISH, "Muestra la puntuación y los enfrentamientos del juego actual"

src/main/java/pw/chew/mlb/commands/SetInfoCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
88
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
99
import net.dv8tion.jda.api.interactions.DiscordLocale;
10+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1011
import net.dv8tion.jda.api.interactions.commands.Command;
1112
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1213
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -36,7 +37,7 @@ public SetInfoCommand() {
3637
DiscordLocale.SPANISH, "Establece el nombre de un canal de voz en una pieza de información especificada."
3738
);
3839

39-
this.guildOnly = true;
40+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
4041
this.userPermissions = new Permission[]{Permission.MANAGE_CHANNEL};
4142
this.botPermissions = new Permission[]{Permission.MANAGE_CHANNEL};
4243

src/main/java/pw/chew/mlb/commands/StandingsCommand.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.jagrosh.jdautilities.command.SlashCommandEvent;
55
import net.dv8tion.jda.api.EmbedBuilder;
66
import net.dv8tion.jda.api.interactions.DiscordLocale;
7+
import net.dv8tion.jda.api.interactions.InteractionContextType;
78
import net.dv8tion.jda.api.interactions.commands.OptionType;
89
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
910
import pw.chew.mlb.util.MLBAPIUtil;
@@ -18,7 +19,7 @@ public class StandingsCommand extends SlashCommand {
1819
public StandingsCommand() {
1920
this.name = "standings";
2021
this.help = "Get the current standings.";
21-
this.guildOnly = false;
22+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD, InteractionContextType.BOT_DM, InteractionContextType.PRIVATE_CHANNEL};
2223
this.options = List.of(
2324
new OptionData(OptionType.STRING, "division", "Select a division to view standings for!", true)
2425
// hardcode MLB for now. eventually milb will be added
@@ -30,8 +31,6 @@ public StandingsCommand() {
3031
.addChoice("NL West", "National League West")
3132
);
3233

33-
// TODO: Future, make this installable in user contexts
34-
3534
this.descriptionLocalization = Map.of(
3635
DiscordLocale.ENGLISH_US, "Get the current standings.",
3736
DiscordLocale.SPANISH, "Obtenga las posiciones actuales.",

src/main/java/pw/chew/mlb/commands/StartGameCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
99
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
1010
import net.dv8tion.jda.api.interactions.DiscordLocale;
11+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1112
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1213
import net.dv8tion.jda.api.interactions.commands.OptionType;
1314
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
@@ -34,7 +35,7 @@ public StartGameCommand() {
3435
DiscordLocale.SPANISH, "Comienza un juego de MLB actualmente activo"
3536
);
3637

37-
this.guildOnly = true;
38+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
3839
this.options = Collections.singletonList(
3940
new OptionData(OptionType.INTEGER, "game", "Which game to listen to", true)
4041
.setDescriptionLocalization(DiscordLocale.SPANISH, "A qué juego escuchar")

src/main/java/pw/chew/mlb/commands/StopGameCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.jagrosh.jdautilities.command.SlashCommandEvent;
55
import net.dv8tion.jda.api.EmbedBuilder;
66
import net.dv8tion.jda.api.interactions.DiscordLocale;
7+
import net.dv8tion.jda.api.interactions.InteractionContextType;
78
import net.dv8tion.jda.api.utils.TimeFormat;
89
import pw.chew.mlb.listeners.GameFeedHandler;
910
import pw.chew.mlb.objects.GameState;
@@ -21,7 +22,7 @@ public StopGameCommand() {
2122
DiscordLocale.SPANISH, "Detiene un juego en el canal actual"
2223
);
2324

24-
this.guildOnly = true;
25+
this.contexts = new InteractionContextType[]{InteractionContextType.GUILD};
2526
}
2627

2728
@Override

0 commit comments

Comments
 (0)