File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
src/main/java/i/fran2019/BotMaster Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 11package i .fran2019 .BotMaster .API .annotations ;
22
3+ import net .dv8tion .jda .api .interactions .IntegrationType ;
34import net .dv8tion .jda .api .interactions .commands .OptionType ;
45
56import java .lang .annotation .Retention ;
Original file line number Diff line number Diff line change 22
33import lombok .Getter ;
44import 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
611public 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 ) {
Original file line number Diff line number Diff line change 88import net .dv8tion .jda .api .events .guild .GuildJoinEvent ;
99import net .dv8tion .jda .api .events .interaction .command .SlashCommandInteractionEvent ;
1010import net .dv8tion .jda .api .hooks .ListenerAdapter ;
11+ import net .dv8tion .jda .api .interactions .IntegrationType ;
12+ import net .dv8tion .jda .api .interactions .InteractionContextType ;
1113import net .dv8tion .jda .api .interactions .commands .OptionMapping ;
1214import net .dv8tion .jda .api .interactions .commands .build .CommandData ;
1315import 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
You can’t perform that action at this time.
0 commit comments