Search in sources :

Example 1 with DiscordListener

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

Aggregations

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