From 7553ec0df6feb0ed5d9f2528ecc4dc461f30f5cd Mon Sep 17 00:00:00 2001 From: Almighty-Satan <43804777+Almighty-Satan@users.noreply.github.com> Date: Sun, 14 Jan 2024 11:42:39 +0100 Subject: [PATCH] Fix slf4j errors on Discord-Bot startup --- build.gradle.kts | 3 +++ src/de/cuuky/varo/bot/discord/VaroDiscordBot.java | 2 +- src/de/cuuky/varo/data/Dependencies.java | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index aea9cb55..e9b39599 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -78,6 +78,9 @@ dependencies { runtimeDownload("net.dv8tion:JDA:5.0.0-beta.19") { exclude(module = "opus-java") } + runtimeDownload("org.slf4j:slf4j-simple:1.7.36") { + exclude(module = "slf4j-api") + } runtimeDownload("com.github.pengrad:java-telegram-bot-api:6.9.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") diff --git a/src/de/cuuky/varo/bot/discord/VaroDiscordBot.java b/src/de/cuuky/varo/bot/discord/VaroDiscordBot.java index aa8d93a9..c7bf5a5c 100644 --- a/src/de/cuuky/varo/bot/discord/VaroDiscordBot.java +++ b/src/de/cuuky/varo/bot/discord/VaroDiscordBot.java @@ -39,7 +39,7 @@ private Color getRandomColor() { @Override public void connect() { - System.out.println(Main.getConsolePrefix() + "Activating discord bot... (Errors might appear - don't mind them)"); + System.out.println(Main.getConsolePrefix() + "Activating discord bot..."); JDABuilder builder = JDABuilder.createLight(ConfigSetting.DISCORDBOT_TOKEN.getValueAsString()); builder.setActivity(Activity.customStatus(ConfigSetting.DISCORDBOT_GAMESTATE.getValueAsString())); builder.setAutoReconnect(true); diff --git a/src/de/cuuky/varo/data/Dependencies.java b/src/de/cuuky/varo/data/Dependencies.java index d7c1536e..0751ae52 100644 --- a/src/de/cuuky/varo/data/Dependencies.java +++ b/src/de/cuuky/varo/data/Dependencies.java @@ -46,6 +46,7 @@ public class Dependencies { static { OPTIONAL_DEPENDENCIES.add(new VaroDependency("gson", MAVEN_CENTERAL, JarDependency::new, () -> !doesClassExist("com.google.gson.JsonElement"))); OPTIONAL_DEPENDENCIES.add(new VaroDependency("JDA", MAVEN_CENTERAL, JarDependency::new, () -> ConfigSetting.DISCORDBOT_ENABLED.getValueAsBoolean() && !doesClassExist("net.dv8tion.jda.api.JDA"))); + OPTIONAL_DEPENDENCIES.add(new VaroDependency("slf4j-simple", MAVEN_CENTERAL, JarDependency::new, () -> ConfigSetting.DISCORDBOT_ENABLED.getValueAsBoolean() && !doesClassExist("org.slf4j.impl.SimpleLogger"))); OPTIONAL_DEPENDENCIES.add(new VaroDependency("java-telegram-bot-api", MAVEN_CENTERAL, JarDependency::new, () -> ConfigSetting.TELEGRAM_ENABLED.getValueAsBoolean() && !doesClassExist("com.pengrad.telegrambot.TelegramBot"))); }