I have one problem with JDA, when I try to load an event to detect new messages on a Discord channel, it doesn't detect it, but it detects private messages, I don't know how I can fix this.
public static void main(String[] args) {
try {
JDA jda = new JDABuilder(AccountType.BOT).setToken("---").build();
System.out.println("asd");
jda.addEventListener(new Core());
} catch (LoginException e) {
e.printStackTrace();
}
}
// this workds and detecting private messages
@Override
public void onMessageReceived(MessageReceivedEvent event) {
if(event.getAuthor().isBot()) {
return;
}
System.out.println("asdasdasds");
}
//no detect public channel messages
@Override
public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
if(event.getAuthor().isBot()) {
return;
}
System.out.println("bsbsbsbsb");
}
You're using a deprecated constructor for JDA.
You should use JDABuilder#createDefault()
or one of the other non-deprecated ways to construct JDA.
See full documentation here: https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/JDABuilder.html