|
|
|
@ -5,14 +5,12 @@ import io.micronaut.context.annotation.Value;
|
|
|
|
|
import io.micronaut.core.annotation.Introspected;
|
|
|
|
|
import jakarta.inject.Inject;
|
|
|
|
|
import jakarta.inject.Singleton;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import javax.security.auth.login.LoginException;
|
|
|
|
|
import me.goudham.command.ICommand;
|
|
|
|
|
import net.dv8tion.jda.api.JDA;
|
|
|
|
|
import net.dv8tion.jda.api.JDABuilder;
|
|
|
|
|
import net.dv8tion.jda.api.entities.Activity;
|
|
|
|
|
import net.dv8tion.jda.api.entities.Guild;
|
|
|
|
|
import net.dv8tion.jda.api.requests.GatewayIntent;
|
|
|
|
|
import net.dv8tion.jda.api.utils.cache.CacheFlag;
|
|
|
|
|
|
|
|
|
@ -20,15 +18,22 @@ import net.dv8tion.jda.api.utils.cache.CacheFlag;
|
|
|
|
|
@Introspected
|
|
|
|
|
public class BotConfig {
|
|
|
|
|
private final String token;
|
|
|
|
|
private final String guildId;
|
|
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
|
public BotConfig(@Value(value = "${bot.token}") String token) {
|
|
|
|
|
public BotConfig(@Value("${bot.token}") String token,
|
|
|
|
|
@Value("${bot.guild.id}") String guildId) {
|
|
|
|
|
this.token = token;
|
|
|
|
|
this.guildId = guildId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
|
Map<String, List<ICommand>> commandsMap() {
|
|
|
|
|
return Collections.emptyMap();
|
|
|
|
|
public Guild guild(JDA jda) {
|
|
|
|
|
Guild ownerGuild = jda.getGuildById(guildId);
|
|
|
|
|
if (ownerGuild == null) {
|
|
|
|
|
throw new RuntimeException("Owner Guild Not Found");
|
|
|
|
|
}
|
|
|
|
|
return ownerGuild;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
|