Skip to content

Commit

Permalink
feat: guild only (pt. 2) #20
Browse files Browse the repository at this point in the history
  • Loading branch information
yaansz committed Oct 9, 2024
1 parent bf0a35b commit 2a5a821
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/softawii/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) throws InterruptedException, NoSuchMethod
JDA JDA = builder.build();
JDA.awaitReady();

boolean reset = false;
boolean reset = true;
CurupiraBoot curupira = new CurupiraBoot(JDA, context, reset, pkg);

JDA.awaitReady();
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/softawii/curupira/v2/core/CurupiraBoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.softawii.curupira.v2.integration.ContextProvider;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.*;
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
Expand All @@ -28,9 +29,18 @@ public CurupiraBoot(@NotNull JDA jda, @NotNull ContextProvider context, boolean
this.jda = jda;
this.logger.info("Curupira configuration loaded. Values: jda={}, registerCommandsToDiscord={}, packages={}", jda, registerCommandsToDiscord, packages);

try {
this.jda.awaitReady();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

// reset commands?
if(registerCommandsToDiscord) {
this.jda.updateCommands().addCommands().queue();
for(Guild guild : this.jda.getGuilds()) {
guild.updateCommands().addCommands().queue();
}
}

this.exceptionMapper = new ExceptionMapper(context, packages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.awt.*;
import java.util.List;

@DiscordController(value = "admin", description = "hello!", guildId = 856534404779868180L, permissions = Permission.ADMINISTRATOR)
@DiscordController(value = "admin2", description = "hello!", guildId = 856534404779868180L, permissions = Permission.ADMINISTRATOR)
public class AdminController {

private static final int guildPageSize = 5;
Expand Down

0 comments on commit 2a5a821

Please sign in to comment.