fix dev commands
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 38s

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

@ -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 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 final String SUPPORT_INVITE_URL = "https://discord.gg/invite/yjj2U3ctEG";
public static String BOT_OWNER = "474221560031608833"; 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");
}
}
} }

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

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

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