Search in sources :

Example 1 with BotListener

use of io.github.lxgaming.discordbot.listeners.BotListener 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();
    }
}
Also used : JDABuilder(net.dv8tion.jda.core.JDABuilder) LoginException(javax.security.auth.login.LoginException) BotListener(io.github.lxgaming.discordbot.listeners.BotListener) RateLimitedException(net.dv8tion.jda.core.exceptions.RateLimitedException)

Aggregations

BotListener (io.github.lxgaming.discordbot.listeners.BotListener)1 LoginException (javax.security.auth.login.LoginException)1 JDABuilder (net.dv8tion.jda.core.JDABuilder)1 RateLimitedException (net.dv8tion.jda.core.exceptions.RateLimitedException)1