use of com.cloudcraftgaming.discal.bot.listeners.ReadyEventListener in project DisCal-Discord-Bot by NovaFox161.
the class Main method main.
public static void main(String[] args) throws IOException {
// Get bot settings
Properties p = new Properties();
p.load(new FileReader(new File("settings.properties")));
BotSettings.init(p);
// Init logger
Logger.getLogger().init();
// Log in to discord
client = createClient(BotSettings.TOKEN.get());
if (client == null)
throw new NullPointerException("Failed to log in! Client cannot be null!");
UpdateDisPwData.init();
Authorization.getAuth().init();
// Connect to MySQL
DatabaseManager.getManager().connectToMySQL();
DatabaseManager.getManager().createTables();
// Start spark (catch any issues from it so only the site goes down without affecting bot....
try {
DiscordAccountHandler.getHandler().init();
SparkUtils.initSpark();
} catch (Exception e) {
Logger.getLogger().exception(null, "'Spark ERROR' by 'PANIC! AT THE WEBSITE'", e, Main.class, true);
}
// Register events
EventDispatcher dispatcher = client.getDispatcher();
dispatcher.registerListener(new ReadyEventListener());
// Register modules
CommandExecutor executor = CommandExecutor.getExecutor().enable();
executor.registerCommand(new HelpCommand());
executor.registerCommand(new DisCalCommand());
executor.registerCommand(new CalendarCommand());
executor.registerCommand(new AddCalendarCommand());
executor.registerCommand(new LinkCalendarCommand());
executor.registerCommand(new TimeCommand());
executor.registerCommand(new EventListCommand());
executor.registerCommand(new EventCommand());
executor.registerCommand(new RsvpCommand());
executor.registerCommand(new AnnouncementCommand());
executor.registerCommand(new DevCommand());
// Load language files.
MessageManager.loadLangs();
// Accept commands
ConsoleCommandExecutor.init();
}
Aggregations