Search in sources :

Example 1 with ShardListener

use of me.shadorc.shadbot.listener.ShardListener in project Shadbot by Shadorc.

the class Shadbot method main.

public static void main(String[] args) {
    Locale.setDefault(new Locale("en", "US"));
    // Initialization
    if (!DataManager.init() || !CommandManager.init()) {
        System.exit(1);
    }
    Runtime.getRuntime().addShutdownHook(new Thread() {

        @Override
        public void run() {
            DataManager.stop();
        }
    });
    client = new ClientBuilder().withToken(APIKeys.get(APIKey.DISCORD_TOKEN)).withRecommendedShardCount().withPingTimeout(10).setMaxReconnectAttempts(10).setMaxMessageCacheCount(100).setPresence(StatusType.IDLE).build();
    LogUtils.infof("Connecting to %s...", StringUtils.pluralOf(client.getShardCount(), "shard"));
    client.getDispatcher().registerListeners(Shadbot.getEventThreadPool(), new ReadyListener(), new ShardListener());
    client.login();
}
Also used : Locale(java.util.Locale) ReadyListener(me.shadorc.shadbot.listener.ReadyListener) ShardListener(me.shadorc.shadbot.listener.ShardListener) ClientBuilder(sx.blah.discord.api.ClientBuilder)

Aggregations

Locale (java.util.Locale)1 ReadyListener (me.shadorc.shadbot.listener.ReadyListener)1 ShardListener (me.shadorc.shadbot.listener.ShardListener)1 ClientBuilder (sx.blah.discord.api.ClientBuilder)1