Register commands when JDA is ready
This commit is contained in:
parent
b0ad269131
commit
e56a5c6f8d
|
|
@ -1,6 +1,7 @@
|
||||||
package com.alttd;
|
package com.alttd;
|
||||||
|
|
||||||
import com.alttd.commandManager.CommandManager;
|
import com.alttd.commandManager.CommandManager;
|
||||||
|
import com.alttd.commandManager.listeners.JDAListener;
|
||||||
import com.alttd.config.SettingsConfig;
|
import com.alttd.config.SettingsConfig;
|
||||||
import com.alttd.config.MessagesConfig;
|
import com.alttd.config.MessagesConfig;
|
||||||
import com.alttd.console.ConsoleCommandManager;
|
import com.alttd.console.ConsoleCommandManager;
|
||||||
|
|
@ -59,7 +60,7 @@ public class AltitudeBot {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initListeners() {
|
private void initListeners() {
|
||||||
jda.addEventListener(new CommandManager(jda));
|
jda.addEventListener(new JDAListener(jda));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initConfigs() {
|
private void initConfigs() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.alttd.commandManager.listeners;
|
||||||
|
|
||||||
|
import com.alttd.commandManager.CommandManager;
|
||||||
|
import com.alttd.util.Logger;
|
||||||
|
import net.dv8tion.jda.api.JDA;
|
||||||
|
import net.dv8tion.jda.api.events.ReadyEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class JDAListener extends ListenerAdapter {
|
||||||
|
|
||||||
|
private final JDA jda;
|
||||||
|
|
||||||
|
public JDAListener(JDA jda) {
|
||||||
|
this.jda = jda;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReady(@NotNull ReadyEvent event) {
|
||||||
|
Logger.info("JDA ready registering commands.");
|
||||||
|
jda.addEventListener(new CommandManager(jda));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user