use of net.kodehawa.mantarobot.core.listeners.events.PostLoadEvent in project MantaroBot by Mantaro.
the class ShardedMantaro method startPostLoadProcedure.
private void startPostLoadProcedure(long start) {
long end = System.currentTimeMillis();
MantaroBot bot = MantaroBot.getInstance();
// Start the reconnect queue.
bot.getCore().markAsReady();
System.out.println("[-=-=-=-=-=- MANTARO STARTED -=-=-=-=-=-]");
LogUtils.shard(String.format("Loaded all %d shards in %d seconds.", totalShards, (end - start) / 1000));
log.info("Loaded all shards successfully... Starting ShardWatcher! Status: {}", MantaroCore.getLoadState());
Async.thread("ShardWatcherThread", new ShardWatcher());
bot.getCore().getShardEventBus().post(new PostLoadEvent());
startUpdaters();
bot.startCheckingBirthdays();
Async.task(() -> {
try {
SnowflakeCacheView<VoiceChannel> vc = MantaroBot.getInstance().getVoiceChannelCache();
MantaroBot.getInstance().getStatsClient().gauge("music_players", vc.stream().filter(voiceChannel -> voiceChannel.getMembers().contains(voiceChannel.getGuild().getSelfMember())).count());
}// Avoid the scheduled task to unexpectedly end on exception (probably ConcurrentModificationException but let's just catch all errors)
catch (Exception ignored) {
}
}, 20, TimeUnit.SECONDS);
}
Aggregations