|
|
@ -11,7 +11,9 @@ import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import javax.security.auth.login.LoginException;
|
|
|
|
import javax.security.auth.login.LoginException;
|
|
|
|
|
|
|
|
import me.goudham.command.CommandHandler;
|
|
|
|
import me.goudham.listener.OnReadyListener;
|
|
|
|
import me.goudham.listener.OnReadyListener;
|
|
|
|
|
|
|
|
import me.goudham.listener.SlashCommandListener;
|
|
|
|
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.entities.Activity;
|
|
|
|
import net.dv8tion.jda.api.entities.Activity;
|
|
|
@ -38,25 +40,16 @@ public class BotConfig {
|
|
|
|
return new HashMap<>();
|
|
|
|
return new HashMap<>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
|
|
|
|
@Order(2)
|
|
|
|
|
|
|
|
public Guild ownerGuild(JDA jda) throws InterruptedException {
|
|
|
|
|
|
|
|
jda.awaitStatus(JDA.Status.CONNECTED);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Guild ownerGuild = jda.getGuildById(guildId);
|
|
|
|
|
|
|
|
if (ownerGuild == null) {
|
|
|
|
|
|
|
|
throw new RuntimeException("Owner Guild Not Found");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ownerGuild;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
@Singleton
|
|
|
|
@Order(1)
|
|
|
|
@Order(1)
|
|
|
|
public JDA jda() throws LoginException {
|
|
|
|
public JDA jda(CommandHandler commandHandler) throws LoginException {
|
|
|
|
return JDABuilder
|
|
|
|
return JDABuilder
|
|
|
|
.createDefault(token)
|
|
|
|
.createDefault(token)
|
|
|
|
.setActivity(Activity.playing("With Hamothy"))
|
|
|
|
.setActivity(Activity.playing("With Hamothy"))
|
|
|
|
.addEventListeners(new OnReadyListener())
|
|
|
|
.addEventListeners(
|
|
|
|
|
|
|
|
new OnReadyListener(),
|
|
|
|
|
|
|
|
new SlashCommandListener(commandHandler)
|
|
|
|
|
|
|
|
)
|
|
|
|
.enableIntents(
|
|
|
|
.enableIntents(
|
|
|
|
List.of(
|
|
|
|
List.of(
|
|
|
|
GatewayIntent.GUILD_MEMBERS,
|
|
|
|
GatewayIntent.GUILD_MEMBERS,
|
|
|
@ -69,4 +62,16 @@ public class BotConfig {
|
|
|
|
).enableCache(CacheFlag.VOICE_STATE)
|
|
|
|
).enableCache(CacheFlag.VOICE_STATE)
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
|
|
|
|
@Order(2)
|
|
|
|
|
|
|
|
public Guild ownerGuild(JDA jda) throws InterruptedException {
|
|
|
|
|
|
|
|
jda.awaitStatus(JDA.Status.CONNECTED);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Guild ownerGuild = jda.getGuildById(guildId);
|
|
|
|
|
|
|
|
if (ownerGuild == null) {
|
|
|
|
|
|
|
|
throw new RuntimeException("Owner Guild Not Found");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ownerGuild;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|