Search in sources :

Example 1 with DisconnectEvent

use of net.dv8tion.jda.core.events.DisconnectEvent in project MantaroBot by Mantaro.

the class MantaroListener method onEvent.

@Override
public void onEvent(Event event) {
    if (event instanceof ShardMonitorEvent) {
        if (MantaroBot.getInstance().getShards()[shardId].getEventManager().getLastJDAEventTimeDiff() > 120000)
            return;
        ((ShardMonitorEvent) event).alive(shardId, ShardMonitorEvent.MANTARO_LISTENER);
        return;
    }
    if (event instanceof GuildMessageReceivedEvent) {
        GuildMessageReceivedEvent e = (GuildMessageReceivedEvent) event;
        Async.thread("BirthdayThread", () -> onMessage(e));
        return;
    }
    //Log intensifies
    if (event instanceof GuildMessageUpdateEvent) {
        Async.thread("LogThread(Edit)", () -> logEdit((GuildMessageUpdateEvent) event));
        return;
    }
    if (event instanceof GuildMessageDeleteEvent) {
        Async.thread("LogThread(Delete)", () -> logDelete((GuildMessageDeleteEvent) event));
        return;
    }
    if (event instanceof GuildMemberJoinEvent) {
        Async.thread("LogThread(Join)", () -> onUserJoin((GuildMemberJoinEvent) event));
        return;
    }
    if (event instanceof GuildMemberLeaveEvent) {
        Async.thread("LogThread(Leave)", () -> onUserLeave((GuildMemberLeaveEvent) event));
        return;
    }
    if (event instanceof GuildUnbanEvent) {
        Async.thread("LogThread(Unban)", () -> logUnban((GuildUnbanEvent) event));
        return;
    }
    if (event instanceof GuildBanEvent) {
        Async.thread("LogThread(Ban)", () -> logBan((GuildBanEvent) event));
        return;
    }
    if (event instanceof GuildJoinEvent) {
        Async.thread("LogThread(GuildJoin)", () -> onJoin((GuildJoinEvent) event));
        return;
    }
    if (event instanceof GuildLeaveEvent) {
        Async.thread("LogThread(GuildLeave)", () -> onLeave((GuildLeaveEvent) event));
    }
    //debug
    if (event instanceof StatusChangeEvent) {
        logStatusChange((StatusChangeEvent) event);
    }
    if (event instanceof DisconnectEvent) {
        onDisconnect((DisconnectEvent) event);
    }
    if (event instanceof ExceptionEvent) {
        onException((ExceptionEvent) event);
    }
}
Also used : ExceptionEvent(net.dv8tion.jda.core.events.ExceptionEvent) GuildJoinEvent(net.dv8tion.jda.core.events.guild.GuildJoinEvent) StatusChangeEvent(net.dv8tion.jda.core.events.StatusChangeEvent) GuildMemberJoinEvent(net.dv8tion.jda.core.events.guild.member.GuildMemberJoinEvent) GuildMemberLeaveEvent(net.dv8tion.jda.core.events.guild.member.GuildMemberLeaveEvent) GuildMessageUpdateEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent) GuildLeaveEvent(net.dv8tion.jda.core.events.guild.GuildLeaveEvent) GuildBanEvent(net.dv8tion.jda.core.events.guild.GuildBanEvent) ShardMonitorEvent(net.kodehawa.mantarobot.core.ShardMonitorEvent) GuildMessageDeleteEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageDeleteEvent) GuildUnbanEvent(net.dv8tion.jda.core.events.guild.GuildUnbanEvent) DisconnectEvent(net.dv8tion.jda.core.events.DisconnectEvent) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)

Aggregations

DisconnectEvent (net.dv8tion.jda.core.events.DisconnectEvent)1 ExceptionEvent (net.dv8tion.jda.core.events.ExceptionEvent)1 StatusChangeEvent (net.dv8tion.jda.core.events.StatusChangeEvent)1 GuildBanEvent (net.dv8tion.jda.core.events.guild.GuildBanEvent)1 GuildJoinEvent (net.dv8tion.jda.core.events.guild.GuildJoinEvent)1 GuildLeaveEvent (net.dv8tion.jda.core.events.guild.GuildLeaveEvent)1 GuildUnbanEvent (net.dv8tion.jda.core.events.guild.GuildUnbanEvent)1 GuildMemberJoinEvent (net.dv8tion.jda.core.events.guild.member.GuildMemberJoinEvent)1 GuildMemberLeaveEvent (net.dv8tion.jda.core.events.guild.member.GuildMemberLeaveEvent)1 GuildMessageDeleteEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageDeleteEvent)1 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)1 GuildMessageUpdateEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent)1 ShardMonitorEvent (net.kodehawa.mantarobot.core.ShardMonitorEvent)1