From bae7b79cd04af394b3d44dbc4b3523783706d938 Mon Sep 17 00:00:00 2001 From: nltbee Date: Thu, 14 Apr 2022 10:22:22 +0200 Subject: [PATCH] Hot-fix FreeCommand ignoring messages from guild After updating to JDA5, GuildMessageReceviedEvent was removed. MessageReceivedEvent has to be used instead. To "counter" this, one can use the isFromGuild method. I use this method, but incorrect. I should invert the if statemen; if the message is NOT from a guild, ignore. This modification fixes the update that broke the help system. --- .../java/org/togetherjava/tjbot/commands/free/FreeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/togetherjava/tjbot/commands/free/FreeCommand.java b/application/src/main/java/org/togetherjava/tjbot/commands/free/FreeCommand.java index 5ac0ff2b57..3814855c94 100644 --- a/application/src/main/java/org/togetherjava/tjbot/commands/free/FreeCommand.java +++ b/application/src/main/java/org/togetherjava/tjbot/commands/free/FreeCommand.java @@ -295,7 +295,7 @@ public void onEvent(@NotNull GenericEvent event) { if (event instanceof ReadyEvent readyEvent) { onReady(readyEvent); } else if (event instanceof MessageReceivedEvent messageEvent) { - if (messageEvent.isFromGuild()) { + if (!messageEvent.isFromGuild()) { return; }