package co.phoenixlab.discord;

import co.phoenixlab.discord.api.entities.Message;
import co.phoenixlab.discord.api.entities.User;
import co.phoenixlab.discord.api.event.MessageReceivedEvent;
import com.google.common.eventbus.Subscribe;

public class EventListener {

    private final VahrhedralBot bot;

    public EventListener(VahrhedralBot bot) {
        this.bot = bot;
    }

    @Subscribe
    public void onMessageRecieved(MessageReceivedEvent messageReceivedEvent) {
        Message message = messageReceivedEvent.getMessage();
        if (message.getContent().startsWith(bot.getConfig().getCommandPrefix())) {
            bot.getMainCommandDispatcher().handleCommand(message);
            return;
        }
        User me = bot.getApiClient().getClientUser();
        for (User user : message.getMentions()) {
            if (me.equals(user)) {
                String otherId = message.getAuthor().getId();
                bot.getApiClient().sendMessage(bot.getLocalizer().localize("message.mention.response", otherId),
                        message.getChannelId(), new String[] {otherId});
                return;
            }
        }
    }

}

@@ -850,32 +850,169 @@
 ser)) %7B%0A        
+        handleMention(message);%0A                return;%0A            %7D%0A        %7D%0A    %7D%0A%0A    private void handleMention(Message message) %7B%0A
         String o
@@ -1049,24 +1049,16 @@
 etId();%0A
-        
         
@@ -1170,24 +1170,16 @@
         
-     
-   
 message.
@@ -1227,57 +1227,10 @@
     
-            return;%0A            %7D%0A        %7D%0A    
 %7D
+%0A
 %0A%0A%7D%0A

Split mention handling out