Search in sources :

Example 1 with GuildReadyListener

use of de.c0debase.bot.listener.other.GuildReadyListener in project c0debaseBot by Biospheere.

the class Codebase method initializeJDA.

/**
 * @return The {@link JDA} instance fot the current session
 * @throws Exception
 */
private JDA initializeJDA() throws Exception {
    try {
        final JDABuilder jdaBuilder = JDABuilder.createDefault(System.getenv("DISCORD_TOKEN"));
        jdaBuilder.setEnabledIntents(GatewayIntent.getIntents(GatewayIntent.ALL_INTENTS));
        jdaBuilder.setMemberCachePolicy(MemberCachePolicy.ALL);
        jdaBuilder.setActivity(Activity.playing("auf c0debase"));
        jdaBuilder.addEventListeners(new GuildReadyListener(this));
        return jdaBuilder.build().awaitReady();
    } catch (Exception exception) {
        logger.error("Encountered exception while initializing JDA!");
        throw exception;
    }
}
Also used : GuildReadyListener(de.c0debase.bot.listener.other.GuildReadyListener) JDABuilder(net.dv8tion.jda.api.JDABuilder)

Aggregations

GuildReadyListener (de.c0debase.bot.listener.other.GuildReadyListener)1 JDABuilder (net.dv8tion.jda.api.JDABuilder)1