command for checking and setting api status

This commit is contained in:
2025-07-12 16:56:41 +02:00
parent 6c0e81897a
commit 74f90df769
4 changed files with 148 additions and 2 deletions
@@ -1,6 +1,9 @@
package me.youhavetrouble.inviter;
import me.youhavetrouble.inviter.discord.command.ApiStatusChangeCommand;
import me.youhavetrouble.inviter.discord.command.Command;
import me.youhavetrouble.inviter.discord.listener.GuildJoinAndLeaveListener;
import me.youhavetrouble.inviter.discord.listener.SlashCommandInteractionListener;
import me.youhavetrouble.inviter.http.ApiServer;
import me.youhavetrouble.inviter.discord.DiscordInviteManager;
import me.youhavetrouble.inviter.storage.SqliteStorage;
@@ -76,11 +79,16 @@ public class Main {
jda = JDABuilder.createLight(token, Set.of(GatewayIntent.GUILD_INVITES))
.setCallbackPool(Executors.newVirtualThreadPerTaskExecutor())
.addEventListeners(new GuildJoinAndLeaveListener())
.addEventListeners(
new GuildJoinAndLeaveListener(),
new SlashCommandInteractionListener()
)
.build();
jda.awaitReady();
Command.registerCommand(new ApiStatusChangeCommand());
jda.getGuilds().parallelStream().forEach(guild -> storage.saveDefaultGuildSettings(guild.getIdLong()));
discordInviteManager = new DiscordInviteManager(jda);
@@ -92,7 +100,7 @@ public class Main {
System.exit(1);
}
LOGGER.info("Welcome to the Inviter Application!");
LOGGER.info("Inviter is up and running!");
}
public static JDA getJda() {