src/main/java/core/commands/CustomInterfacedEventManager.java
/**
     * @param event We are taking advantage from only using three types of events in
     *              the whole bot , so we avoid less checking, for the momnent those
     *              are MessageReceivedEvent, GuildMemberLeaveEvent and
     *              MessageReactionAddEvent If you are using any other , pls modify
     *              the code or use the default one
     */
@param event We are taking advantage from only using three types of events in
the whole bot , so we avoid less checking, for the momnent those
are MessageReceivedEvent, GuildMemberLeaveEvent and
MessageReactionAddEvent If you are using any other , pls modify
the code or use the default one
@param event We are taking advantage from only using three types of events in the whole bot so we avoid less checking for the momnent those are MessageReceivedEvent GuildMemberLeaveEvent and MessageReactionAddEvent If you are using any other pls modify the code or use the default one
@Override
    public void handle(@Nonnull GenericEvent event) {
        if (event instanceof MessageReceivedEvent) {
            MessageReceivedEvent mes = (MessageReceivedEvent) event;
            if (mes.getAuthor().isBot()) {
                return;
            }
            Character correspondingPrefix = Chuu.getCorrespondingPrefix(mes);
            String contentRaw = mes.getMessage().getContentRaw();
            if (contentRaw.length() <= 1 || contentRaw.charAt(0) != correspondingPrefix)
                return;
            Map<Long, RateLimiter> ratelimited = Chuu.getRatelimited();
            RateLimiter rateLimiter = ratelimited.get(mes.getAuthor().getIdLong());
            if (rateLimiter != null) {
                if (!rateLimiter.tryAcquire()) {
                    mes.getChannel().sendMessage("You have been rate limited, try again later.").queue();
                    return;
                }
            }
            String substring = contentRaw.substring(1).split("\\s+")[0];
            MyCommand<?> myCommand = commandListeners.get(substring.toLowerCase());
            if (myCommand != null) {
                if (!Chuu.isMessageAllowed(myCommand, mes)) {
                    mes.getChannel().sendMessage("This command is disabled in this channel.").queue();
                    return;
                }
                try {
                    myCommand.onMessageReceived(mes);
                } catch (Throwable throwable) {
                    JDAImpl.LOG.error("One of the EventListeners had an uncaught exception", throwable);
                }
            }
            return;
        }
        if (event instanceof GuildMemberRemoveEvent || event instanceof MessageReactionAddEvent) {
            for (EventListener listener : listeners) {
                try {
                    listener.onEvent(event);
                } catch (Throwable throwable) {
                    JDAImpl.LOG.error("One of the EventListeners had an uncaught exception", throwable);
                }
            }
        }
    }
@ Override public void handle ( @ Nonnull GenericEvent event ) { if ( event instanceof MessageReceivedEvent ) { MessageReceivedEvent mes = ( MessageReceivedEvent ) event ; if ( mes . getAuthor ( ) . isBot ( ) ) { return ; } Character correspondingPrefix = Chuu . getCorrespondingPrefix ( mes ) ; String contentRaw = mes . getMessage ( ) . getContentRaw ( ) ; if ( contentRaw . length ( ) <= 1 || contentRaw . charAt ( 0 ) != correspondingPrefix ) return ; Map < Long , RateLimiter > ratelimited = Chuu . getRatelimited ( ) ; RateLimiter rateLimiter = ratelimited . get ( mes . getAuthor ( ) . getIdLong ( ) ) ; if ( rateLimiter != null ) { if ( ! rateLimiter . tryAcquire ( ) ) { mes . getChannel ( ) . sendMessage ( "You have been rate limited, try again later." ) . queue ( ) ; return ; } } String substring = contentRaw . substring ( 1 ) . split ( "\\s+" ) [ 0 ] ; MyCommand < ? > myCommand = commandListeners . get ( substring . toLowerCase ( ) ) ; if ( myCommand != null ) { if ( ! Chuu . isMessageAllowed ( myCommand , mes ) ) { mes . getChannel ( ) . sendMessage ( "This command is disabled in this channel." ) . queue ( ) ; return ; } try { myCommand . onMessageReceived ( mes ) ; } catch ( Throwable throwable ) { JDAImpl . LOG . error ( "One of the EventListeners had an uncaught exception" , throwable ) ; } } return ; } if ( event instanceof GuildMemberRemoveEvent || event instanceof MessageReactionAddEvent ) { for ( EventListener listener : listeners ) { try { listener . onEvent ( event ) ; } catch ( Throwable throwable ) { JDAImpl . LOG . error ( "One of the EventListeners had an uncaught exception" , throwable ) ; } } } }
@param event We are taking advantage from only using three types of events in
              the whole bot , so we avoid less checking, for the momnent those
              are MessageReceivedEvent, GuildMemberLeaveEvent and
              MessageReactionAddEvent If you are using any other , pls modify
              the code or use the default one
@param event We are taking advantage from only using three types of events in the whole bot so we avoid less checking for the momnent those are MessageReceivedEvent GuildMemberLeaveEvent and MessageReactionAddEvent If you are using any other pls modify the code or use the default one