discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.35k stars 735 forks source link

GuildMessageReceivedEvent fires for private messages #1361

Closed davidovski closed 4 years ago

davidovski commented 4 years ago

General Troubleshooting

Bug Report

The GuildMessageReceivedEvent is fired when the bot receives a private message.

Expected Behavior

This event should not be fired when the message is received in a private message channel.

Code Example or Reproduction Steps

  1. Create a jda instance
  2. Make a new class extending ListenerAdapter
  3. add the method:
    public void onGuildMessageReceived(@Nonnull GuildMessageReceivedEvent event) {
        System.out.println(event.getMessage().getContentDisplay());

    to the class

  4. add the listener to the jda instance.

Code for JDABuilder or DefaultShardManagerBuilder Used

client = JDABuilder.createDefault(config.getString("token"), intents).build();

(intents is a list of intents that the bot will need)

Exception or Error

N/A

MinnDevelopment commented 4 years ago

I can't reproduce this. And the code internals suggest that this is impossible.