fix dev commands

This commit is contained in:
Lee 2024-07-01 22:56:52 +01:00
parent 69281d113c
commit 3146ed7d6d
4 changed files with 22 additions and 8 deletions

View File

@ -7,11 +7,4 @@ public class Consts {
public static final String INVITE_URL = "https://discord.com/oauth2/authorize?client_id=1254161119975833652&permissions=8&integration_type=0&scope=bot+applications.commands";
public static final String SUPPORT_INVITE_URL = "https://discord.gg/invite/yjj2U3ctEG";
public static String BOT_OWNER = "474221560031608833";
public static String ADMIN_GUILD = "1203163422498361404";
static {
if (System.getenv("ADMIN_GUILD") != null) {
ADMIN_GUILD = System.getenv("ADMIN_GUILD");
}
}
}

View File

@ -1,20 +1,37 @@
package cc.fascinated.bat.config;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @author Fascinated (fascinated7)
*/
@Component @Getter
public class Config {
public static Config INSTANCE;
/**
* Is the app running in a production environment?
*/
@Getter
private static final boolean production;
/**
* The ID of the admin guild
*/
private final String adminGuild;
static {
// Are we running on production?
String appEnv = System.getenv("APP_ENV");
production = appEnv != null && (appEnv.equals("production"));
}
@Autowired
public Config(@Value("${bat.admin-guild}") String adminGuild) {
INSTANCE = this;
this.adminGuild = adminGuild;
}
}

View File

@ -75,7 +75,7 @@ public class CommandService extends ListenerAdapter {
JDA jda = DiscordService.JDA;
long before = System.currentTimeMillis();
Guild adminGuild = jda.getGuildById(Consts.ADMIN_GUILD);
Guild adminGuild = jda.getGuildById(Config.INSTANCE.getAdminGuild());
if (!Config.isProduction()) {
if (adminGuild == null) {
log.error("Unable to find the admin guild to register commands");

View File

@ -2,6 +2,10 @@
discord:
token: "oh my goodnesssssssssss"
# Bat Configuration
bat:
admin-guild: 1203163422498361404
# Sentry Configuration
sentry:
dsn: "CHANGE_ME"