use of net.dv8tion.jda.core.exceptions.RateLimitedException in project DiscordBot by LXGaming.
the class Discord method loadDiscord.
public void loadDiscord() {
try {
jda = new JDABuilder(AccountType.BOT).setToken(DiscordBot.getInstance().getConfig().getToken()).addEventListener(new DiscordListener()).setAudioEnabled(true).setBulkDeleteSplittingEnabled(false).buildAsync();
AudioSourceManagers.registerRemoteSources(getAudioPlayerManager());
audioPlayer = getAudioPlayerManager().createPlayer();
getAudioPlayer().setVolume(DiscordBot.getInstance().getConfig().getDefaultVolume());
getAudioPlayer().addListener(new AudioListener());
getDiscordThread().start();
getCommand().registerCommands();
LogHelper.info("Successfully loaded Discord.");
} catch (LoginException | RateLimitedException | RuntimeException ex) {
LogHelper.error("Exception loading Discord!");
ex.printStackTrace();
}
}
use of net.dv8tion.jda.core.exceptions.RateLimitedException in project DiscordBot by LXGaming.
the class DiscordBotCore method postInit.
public void postInit() {
String token = getConfiguration().getToken();
JDABuilder jdaBuilder = null;
if (token != null && !token.equals("") && !token.equals("null")) {
jdaBuilder = new JDABuilder(AccountType.BOT).setToken(token);
}
token = null;
if (jdaBuilder == null) {
getLogger().severe("Cannot start DiscordBot, No Token / Email and Password provided!");
return;
}
try {
jda = jdaBuilder.addEventListener(new BotListener()).setAudioEnabled(false).setBulkDeleteSplittingEnabled(false).buildAsync();
} catch (IllegalArgumentException | LoginException | RateLimitedException ex) {
getLogger().severe("Connection Failed! Invalid BotToken");
ex.printStackTrace();
}
}
Aggregations