Skip to content

Commit 784baed

Browse files
committed
1.1.2
Added InteractionType and ContextType (Only Global)
1 parent 8d7c7c8 commit 784baed

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>i.fran2019.BotMaster</groupId>
88
<artifactId>BotMasterDC</artifactId>
9-
<version>1.1.1</version>
9+
<version>1.1.2</version>
1010

1111
<repositories>
1212
<repository>

src/main/java/i/fran2019/BotMaster/API/annotations/CommandOption.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package i.fran2019.BotMaster.API.annotations;
22

3+
import net.dv8tion.jda.api.interactions.IntegrationType;
34
import net.dv8tion.jda.api.interactions.commands.OptionType;
45

56
import java.lang.annotation.Retention;

src/main/java/i/fran2019/BotMaster/API/implementations/Command.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,36 @@
22

33
import lombok.Getter;
44
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
5+
import net.dv8tion.jda.api.interactions.IntegrationType;
6+
import net.dv8tion.jda.api.interactions.InteractionContextType;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
510

611
public class Command {
712
@Getter String name;
13+
@Getter IntegrationType[] integrationTypes;
14+
@Getter List<InteractionContextType> interactionContextType;
815

916
public Command(String name) {
1017
this.name = name;
18+
this.integrationTypes = new IntegrationType[]{ IntegrationType.GUILD_INSTALL };
19+
this.interactionContextType = new ArrayList<>();
20+
this.interactionContextType.addAll(InteractionContextType.ALL);
21+
22+
}
23+
24+
public Command(String name, IntegrationType[] integrationTypes) {
25+
this.name = name;
26+
this.integrationTypes = integrationTypes;
27+
this.interactionContextType = new ArrayList<>();
28+
this.interactionContextType.addAll(InteractionContextType.ALL);
29+
}
30+
31+
public Command(String name, IntegrationType[] integrationTypes, List<InteractionContextType> interactionContextType) {
32+
this.name = name;
33+
this.integrationTypes = integrationTypes;
34+
this.interactionContextType = interactionContextType;
1135
}
1236

1337
public void onExecute(SlashCommandInteractionEvent e) {

src/main/java/i/fran2019/BotMaster/Managers/CommandManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import net.dv8tion.jda.api.events.guild.GuildJoinEvent;
99
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
1010
import net.dv8tion.jda.api.hooks.ListenerAdapter;
11+
import net.dv8tion.jda.api.interactions.IntegrationType;
12+
import net.dv8tion.jda.api.interactions.InteractionContextType;
1113
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1214
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
1315
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
@@ -140,6 +142,8 @@ private void addCommandData(Command cmd) {
140142
BotMaster.getLogger().debug("[SlashCommands Adder] {}", cmd.getName());
141143
String[] cmdSplit = cmd.getName().toLowerCase().split(" ");
142144
CommandDataImpl commandData = new CommandDataImpl(cmdSplit[0], cmdSplit[0]);
145+
commandData.setIntegrationTypes(cmd.getIntegrationTypes());
146+
commandData.setContexts(cmd.getInteractionContextType());
143147
SubcommandGroupData subcommandGroupData = null;
144148
SubcommandData subcommandData = null;
145149

0 commit comments

Comments
 (0)