Minor edits

This commit is contained in:
floppydiskette 2024-08-27 01:33:14 +01:00
parent 8eb4ca32a1
commit 448f98ba35
Signed by: fwoppydwisk
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
6 changed files with 15 additions and 6 deletions

View file

@ -1,4 +1,4 @@
package net.hypr.doki.commands; package net.hypr.doki.commands.levelling;
import com.freya02.botcommands.api.annotations.CommandMarker; import com.freya02.botcommands.api.annotations.CommandMarker;
import com.freya02.botcommands.api.prefixed.CommandEvent; import com.freya02.botcommands.api.prefixed.CommandEvent;

View file

@ -1,4 +1,4 @@
package net.hypr.doki.commands; package net.hypr.doki.commands.levelling;
import com.freya02.botcommands.api.annotations.CommandMarker; import com.freya02.botcommands.api.annotations.CommandMarker;
import com.freya02.botcommands.api.prefixed.BaseCommandEvent; import com.freya02.botcommands.api.prefixed.BaseCommandEvent;

View file

@ -1,4 +1,4 @@
package net.hypr.doki.commands; package net.hypr.doki.commands.utils;
import com.freya02.botcommands.api.annotations.CommandMarker; import com.freya02.botcommands.api.annotations.CommandMarker;
import com.freya02.botcommands.api.prefixed.CommandEvent; import com.freya02.botcommands.api.prefixed.CommandEvent;

View file

@ -1,4 +1,4 @@
package net.hypr.doki.commands; package net.hypr.doki.commands.utils;
import com.freya02.botcommands.api.annotations.CommandMarker; import com.freya02.botcommands.api.annotations.CommandMarker;
import com.freya02.botcommands.api.prefixed.CommandEvent; import com.freya02.botcommands.api.prefixed.CommandEvent;

View file

@ -1,4 +1,4 @@
package net.hypr.doki.commands; package net.hypr.doki.commands.utils;
import com.freya02.botcommands.api.annotations.CommandMarker; import com.freya02.botcommands.api.annotations.CommandMarker;
import com.freya02.botcommands.api.prefixed.BaseCommandEvent; import com.freya02.botcommands.api.prefixed.BaseCommandEvent;

View file

@ -19,11 +19,20 @@ public class LevellingListener extends ListenerAdapter {
@Override @Override
public void onMessageReceived(MessageReceivedEvent event) { public void onMessageReceived(MessageReceivedEvent event) {
Logger log = Logging.getLogger(); Logger log = Logging.getLogger();
/* Ignore the message if one of the following conditions is met: /* Ignore the message if one of the following conditions is met:
- Message is from self user - Message is from self user
- Message is from bot - Message is from a bot
- Message is command (starts with bot prefix) - Message is command (starts with bot prefix)
- Message is a Direct Message to the bot
*/ */
try {
event.getGuild();
} catch (IllegalStateException ex) {
log.debug("Ignoring direct message with ID {}", event.getMessageId());
return;
}
if ( if (
Doki.getJDA().getSelfUser().getId().equals(event.getAuthor().getId()) || Doki.getJDA().getSelfUser().getId().equals(event.getAuthor().getId()) ||
event.getAuthor().isBot() || event.getAuthor().isBot() ||