|
|
@ -4,31 +4,25 @@ import io.micronaut.context.annotation.Value;
|
|
|
|
import jakarta.inject.Inject;
|
|
|
|
import jakarta.inject.Inject;
|
|
|
|
import jakarta.inject.Singleton;
|
|
|
|
import jakarta.inject.Singleton;
|
|
|
|
import me.goudham.command.CommandManager;
|
|
|
|
import me.goudham.command.CommandManager;
|
|
|
|
import net.dv8tion.jda.api.JDA;
|
|
|
|
|
|
|
|
import net.dv8tion.jda.api.entities.Guild;
|
|
|
|
import net.dv8tion.jda.api.entities.Guild;
|
|
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
@Singleton
|
|
|
|
public class EnsoBot implements Bot {
|
|
|
|
public class EnsoBot implements Bot {
|
|
|
|
private final JDA jda;
|
|
|
|
|
|
|
|
private final Guild guild;
|
|
|
|
private final Guild guild;
|
|
|
|
private final boolean registerCommands;
|
|
|
|
private final boolean registerCommands;
|
|
|
|
private final CommandManager commandManager;
|
|
|
|
private final CommandManager commandManager;
|
|
|
|
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
@Inject
|
|
|
|
public EnsoBot(JDA jda,
|
|
|
|
public EnsoBot(Guild guild,
|
|
|
|
Guild guild,
|
|
|
|
|
|
|
|
@Value("${bot.config.registerCommands}") boolean registerCommands,
|
|
|
|
@Value("${bot.config.registerCommands}") boolean registerCommands,
|
|
|
|
CommandManager commandManager) {
|
|
|
|
CommandManager commandManager) {
|
|
|
|
this.jda = jda;
|
|
|
|
|
|
|
|
this.guild = guild;
|
|
|
|
this.guild = guild;
|
|
|
|
this.registerCommands = registerCommands;
|
|
|
|
this.registerCommands = registerCommands;
|
|
|
|
this.commandManager = commandManager;
|
|
|
|
this.commandManager = commandManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void startup() throws InterruptedException {
|
|
|
|
public void startup() {
|
|
|
|
jda.awaitReady();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (registerCommands) {
|
|
|
|
if (registerCommands) {
|
|
|
|
commandManager.registerSlashCommands(guild);
|
|
|
|
commandManager.registerSlashCommands(guild);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|