Hey,
Whenever I use something like
if (event.isFromType(ChannelType.PRIVATE)) //If this message was sent to a PrivateChannel
{
//The message was sent in a PrivateChannel.
//In this example we don't directly use the privateChannel, however, be sure, there are uses for it!
PrivateChannel privateChannel = event.getPrivateChannel();
System.out.printf("[PRIV]<%s>: %s\n", author.getName(), msg);
privateChannel.sendMessage("This message should only be sent once").queue();
}
And then I send the bot a message, it sends back mutliple times. Let me demonstrate: https://gyazo.com/3cf013f9330b9f1a4190a85ed86e46e0
Any idea why this might be happening? Using your exact example 馃挴
The bot gets an event for its own message.
So, basically, to fix, check if the message is received from a client or is there an own event to recieve message from clients only?
just compare the author to the selfuser
Thanks! You may close the issue if i can't do it myself.
If you need more assistance, please ask in the #java_jda channel
You should check whether the message author is the currently logged in account.
event.getMessage().getAuthor().equals(event.getJDA().getSelfUser())
It is also good practice to ignore messages from Users that are bot accounts User#isBot()
Most helpful comment
The bot gets an event for its own message.