    001package co.aikar.commands;
    002
    003import net.dv8tion.jda.core.entities.ChannelType;
    004import net.dv8tion.jda.core.events.ReadyEvent;
    005import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
    006import net.dv8tion.jda.core.hooks.ListenerAdapter;
    007
    008public class JDAListener extends ListenerAdapter {
    009
    010    private final JDACommandManager manager;
    011
    012    JDAListener(JDACommandManager manager) {
    013
    014        this.manager = manager;
    015    }
    016
    017    @Override
    018    public void onMessageReceived(MessageReceivedEvent event) {
    019        if (event.isFromType(ChannelType.TEXT) || event.isFromType(ChannelType.PRIVATE)) {
    020            this.manager.dispatchEvent(event);
    021        }
    022    }
    023
    024    @Override
    025    public void onReady(ReadyEvent event) {
    026        manager.initializeBotOwner();
    027    }
    028}