discord bot not responding to event

The code is very simple, the bot is just simply not responding when I type hello into the discord channel. The bot has been added properly, and is showing as online.

Main.java

import events.HelloEvent;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;

import javax.security.auth.login.LoginException;

public class Main {
    public static void main(String[] args) throws LoginException {
        JDABuilder builder = new JDABuilder("key");
        builder.addEventListeners(new HelloEvent());
        JDA api = builder.build();
    }
}

HelloEvent.java

package events;

import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;


public class HelloEvent extends ListenerAdapter {

    @Override
    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        String messageSent = event.getMessage().getContentRaw();
        if(messageSent.equalsIgnoreCase("hello")) {
            event.getChannel().sendMessage("what's up my dude").queue();
        }
    }
}


from Recent Questions - Stack Overflow https://ift.tt/3oQ44Un
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation