Compare commits
2 Commits
041cf851b3
...
06b893c7ee
Author | SHA1 | Date | |
---|---|---|---|
06b893c7ee | |||
2fcf0fd647 |
@ -1,5 +1,6 @@
|
|||||||
package tech.nevets.modbot;
|
package tech.nevets.modbot;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.Level;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
@ -21,6 +22,7 @@ public class CoreBot {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CoreBot.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(CoreBot.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
setLoggingLevel(Level.DEBUG);
|
||||||
CORE_CONFIG.addDefaults(getDefaults());
|
CORE_CONFIG.addDefaults(getDefaults());
|
||||||
CORE_CONFIG.loadConfig();
|
CORE_CONFIG.loadConfig();
|
||||||
modules = ModuleLoader.loadModules();
|
modules = ModuleLoader.loadModules();
|
||||||
@ -42,7 +44,11 @@ public class CoreBot {
|
|||||||
|
|
||||||
coreListener.getCommandRegistry().registerSlashCommands();
|
coreListener.getCommandRegistry().registerSlashCommands();
|
||||||
for (BotModule module : modules) {
|
for (BotModule module : modules) {
|
||||||
|
if (module.loadCommandRegistry() == null) {
|
||||||
|
LOGGER.warn("Module has no commands to load");
|
||||||
|
} else {
|
||||||
module.loadCommandRegistry().registerSlashCommands();
|
module.loadCommandRegistry().registerSlashCommands();
|
||||||
|
}
|
||||||
module.onEnable(jda);
|
module.onEnable(jda);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,4 +67,9 @@ public class CoreBot {
|
|||||||
|
|
||||||
return defaults;
|
return defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setLoggingLevel(ch.qos.logback.classic.Level level) {
|
||||||
|
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
|
||||||
|
root.setLevel(level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ public class ModuleLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGGER.debug("Loaded module: " + modules.toArray().toString());
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user