All Downloads are FREE. Search and download functionalities are using the official Maven repository.

discord4j.connect.ExampleSingleConnect Maven / Gradle / Ivy

There is a newer version: 0.6.8
Show newest version
package discord4j.connect;

import discord4j.connect.support.BotSupport;
import discord4j.core.DiscordClientBuilder;
import discord4j.core.GatewayDiscordClient;
import discord4j.core.shard.ShardingStrategy;
import discord4j.store.jdk.JdkStoreService;

public class ExampleSingleConnect {

    public static void main(String[] args) {
        GatewayDiscordClient client = DiscordClientBuilder.create(System.getenv("token"))
                .build()
                .gateway()
                .setStoreService(new JdkStoreService())
                .setSharding(ShardingStrategy.fixed(1))
                .login()
                .blockOptional()
                .orElseThrow(RuntimeException::new);

        BotSupport.create(client)
                .eventHandlers()
                .block();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy