From 37c69597bea03ed1434b1eab10bcce287422675e Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 1 Jul 2024 23:02:28 +0100 Subject: [PATCH] why angry?????? --- src/main/java/cc/fascinated/bat/BatApplication.java | 2 ++ src/main/java/cc/fascinated/bat/service/CommandService.java | 4 +++- src/main/resources/application.yml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/BatApplication.java b/src/main/java/cc/fascinated/bat/BatApplication.java index 09570d2..d20c67f 100644 --- a/src/main/java/cc/fascinated/bat/BatApplication.java +++ b/src/main/java/cc/fascinated/bat/BatApplication.java @@ -6,10 +6,12 @@ import cc.fascinated.bat.service.EventService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import io.mongock.runner.springboot.EnableMongock; +import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import lombok.NonNull; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index a7f4f46..739adba 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -18,6 +18,7 @@ import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.interactions.commands.Command; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.DependsOn; import org.springframework.stereotype.Service; @@ -47,7 +48,8 @@ public class CommandService extends ListenerAdapter { private final UserService userService; @Autowired - public CommandService(@NonNull GuildService guildService, @NonNull UserService userService) { + public CommandService(@NonNull ApplicationContext context, @NonNull GuildService guildService, @NonNull UserService userService) { + context.getBean(Config.class); this.guildService = guildService; this.userService = userService; DiscordService.JDA.addEventListener(this); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 62814af..4ef3db1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,6 +4,8 @@ discord: # Bat Configuration bat: + # This is where commands will be registered (whilst in development mode) + # also where bot owner only commands will be registered admin-guild: 1203163422498361404 # Sentry Configuration