Search in sources :

Example 1 with GuildCreateEvent

use of sx.blah.discord.handle.impl.events.guild.GuildCreateEvent in project KaellyBot by Kaysoro.

the class ReadyListener method onReady.

@EventSubscriber
public void onReady(ReadyEvent event) {
    LOG.info(Constants.name + "Bot connecté !");
    LOG.info("Ajout des différents listeners");
    ClientConfig.DISCORD().getDispatcher().registerListener(new GuildCreateListener());
    ClientConfig.DISCORD().getDispatcher().registerListener(new GuildLeaveListener());
    ClientConfig.DISCORD().getDispatcher().registerListener(new GuildUpdateListener());
    ClientConfig.DISCORD().getDispatcher().registerListener(new ChannelDeleteListener());
    ClientConfig.DISCORD().getDispatcher().registerListener(new UserVoiceChannelMoveListener());
    ClientConfig.DISCORD().getDispatcher().registerListener(new UserVoiceChannelLeaveListener());
    LOG.info("Check des guildes");
    for (IGuild guild : ClientConfig.DISCORD().getGuilds()) if (Guild.getGuilds().containsKey(guild.getStringID()) && !guild.getName().equals(Guild.getGuild(guild).getName()))
        Guild.getGuild(guild).setName(guild.getName());
    else
        ClientConfig.DISCORD().getDispatcher().dispatch(new GuildCreateEvent(guild));
    // Check des guildes éventuellement supprimé durant l'absence
    List<String> ids = new ArrayList<>(Guild.getGuilds().keySet());
    for (String guildID : ids) if (ClientConfig.DISCORD().getGuildByID(Long.parseLong(guildID)) == null) {
        LOG.info(Guild.getGuilds().get(guildID).getName() + " a supprimé " + Constants.name + " en son absence.");
        Guild.getGuilds().get(guildID).removeToDatabase();
    }
    // Joue à...
    ClientConfig.DISCORD().changePresence(StatusType.ONLINE, ActivityType.WATCHING, Constants.discordInvite);
    LOG.info("Ecoute des flux RSS du site Dofus...");
    RSSFinder.start();
    LOG.info("Récupération des positions de portails...");
    PortalFinder.start();
    LOG.info("Lancement du calendrier Almanax...");
    AlmanaxCalendar.start();
    LOG.info("Connexion à l'API Twitter...");
    TwitterFinder.start();
    LOG.info("Ecoute des messages...");
    ClientConfig.DISCORD().getDispatcher().registerListener(new MessageListener());
}
Also used : GuildCreateEvent(sx.blah.discord.handle.impl.events.guild.GuildCreateEvent) ArrayList(java.util.ArrayList) IGuild(sx.blah.discord.handle.obj.IGuild) EventSubscriber(sx.blah.discord.api.events.EventSubscriber)

Aggregations

ArrayList (java.util.ArrayList)1 EventSubscriber (sx.blah.discord.api.events.EventSubscriber)1 GuildCreateEvent (sx.blah.discord.handle.impl.events.guild.GuildCreateEvent)1 IGuild (sx.blah.discord.handle.obj.IGuild)1