use of com.arsenarsen.lavaplayerbridge.utils.JDAMultiShard in project FlareBot by FlareBot.
the class FlareBot method run.
protected void run() {
if (RUNNING.getAndSet(true))
return;
LOGGER.info("Starting run sequence");
try {
musicManager = PlayerManager.getPlayerManager(LibraryFactory.getLibrary(new JDAMultiShard(Getters.getShardManager())));
} catch (UnknownBindingException e) {
LOGGER.error("Failed to initialize musicManager", e);
}
musicManager.getPlayerCreateHooks().register(player -> player.getQueueHookManager().register(new QueueListener()));
// Any migration
MigrationHandler migrationHandler = new MigrationHandler();
LOGGER.info("Loaded " + commandManager.count() + " commands!");
ApiFactory.bind();
LOGGER.info("Bound API");
musicManager.getPlayerCreateHooks().register(player -> player.addEventListener(new PlayerListener(player)));
analyticsHandler = new AnalyticsHandler();
analyticsHandler.registerAnalyticSender(new ActivityAnalytics());
analyticsHandler.registerAnalyticSender(new GuildAnalytics());
analyticsHandler.registerAnalyticSender(new GuildCountAnalytics());
LOGGER.info("Registered analytics - Running");
analyticsHandler.run(isTestBot() ? 1000 : -1);
GeneralUtils.methodErrorHandler(LOGGER, null, "Executed creations!", "Failed to execute creations!", () -> manager.executeCreations());
GeneralUtils.methodErrorHandler(LOGGER, null, "Loaded future tasks!", "Failed to load future tasks!", this::loadFutureTasks);
startTime = System.currentTimeMillis();
LOGGER.info("FlareBot v" + getVersion() + " booted!");
GeneralUtils.methodErrorHandler(LOGGER, null, "Sent commands to site!", "Failed to send commands to site!", this::sendCommands);
GeneralUtils.methodErrorHandler(LOGGER, "Starting tasks!", "Started all tasks, run complete!", "Failed to start all tasks!", this::runTasks);
}
Aggregations