Kaktushose / jda-commands

A declarative, annotation driven command library for JDA
https://github.com/Kaktushose/jda-commands/wiki
Apache License 2.0
66 stars 11 forks source link

[BUG] Some commands are not registering #123

Closed raffel080108 closed 1 year ago

raffel080108 commented 1 year ago

Some of my commands are not registering, 3 specifically - I have no idea why, tested a few things alr... I included the full code of the 3 non-working commands, as well as the full code of 2 other commands that are working correctly. I have already tried moving the 3 non-working commands to the same package as the working ones with no effect

Command 1 (Not showing up):

package raffel080108.wafflebot.commands.addfilter;

import com.github.kaktushose.jda.commands.annotations.interactions.Interaction;
import com.github.kaktushose.jda.commands.annotations.interactions.Optional;
import com.github.kaktushose.jda.commands.annotations.interactions.Param;
import com.github.kaktushose.jda.commands.annotations.interactions.SlashCommand;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import raffel080108.wafflebot.util.FilterUtils;

@Interaction
public class AddAllFilter {
    @SlashCommand(value = "addtextfilter", desc = "Filter deletes all messages", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)
    public void addAllFilterCommand(CommandEvent event,
                                    @Param(name = "channel", value = "The channel to add the filter to") @Optional TextChannel channel) {
        if (channel == null)
            channel = event.getTextChannel();

        FilterUtils.registerFilterWithChecks(event, channel.getIdLong(), "all");
    }
}

Command 2 (Not showing up):

package raffel080108.wafflebot.commands.addfilter;

import com.github.kaktushose.jda.commands.annotations.interactions.*;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import raffel080108.wafflebot.util.FilterUtils;

@Interaction
public class AddAttachmentsFilter {
    @SlashCommand(value = "addattachmentsfilter", desc = "Filter deletes based on attachments",
            enabledFor = Permission.ADMINISTRATOR, isGuildOnly = true)
    public void addAttachmentsFilterCommand(CommandEvent event,
                                            @Param(name = "channel", value = "The channel to add the filter to") @Optional TextChannel channel,
                                            @Param(name = "type", value = "If the filter should be inclusive or exclusive")
                                                @Choices({"Must have attachments", "No attachments"}) String type) {
        if (channel == null)
            channel = event.getTextChannel();

        type = switch (type) {
            case "Must have attachments" -> "incl";
            case "No attachments" -> "excl";
            default -> throw new IllegalArgumentException("Unexpected value for 'type': " + type);
        };

        FilterUtils.registerFilterWithChecks(event, channel.getIdLong(), "attachments." + type);
    }
}

Command 3 (Not showing up):

package raffel080108.wafflebot.commands.addfilter;

import com.github.kaktushose.jda.commands.annotations.interactions.*;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import raffel080108.wafflebot.util.FilterUtils;

@Interaction
public class AddTextFilter {
    @SlashCommand(value = "addtextfilter", desc = "Filter deletes based on text-match", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)
    public void addTextFilterCommand(CommandEvent event,
                                     @Param(name = "channel", value = "The channel to add the filter to") @Optional TextChannel channel,
                                     @Param(name = "type", value = "If the filter should be inclusive or exclusive")
                                         @Choices({"Inclusive", "Exclusive"}) String type,
                                     @Param(name = "text", value = "The text to match") String text,
                                     @Param(name = "is-regex", value = "Regex match instead of literal")
                                     @Optional("false") @Choices({"true", "false"}) boolean isRegex) {
        if (channel == null)
            channel = event.getTextChannel();

        type = switch (type) {
            case "Inclusive" -> "incl";
            case "Exclusive" -> "excl";
            default -> throw new IllegalArgumentException("Unexpected value for 'type': " + type);
        };

        FilterUtils.registerFilterWithChecks(event, channel.getIdLong(), "text." + type + (isRegex ? ".reg" : ""), text);
    }
}

Command 4 (Working fine):

package raffel080108.wafflebot.commands.toggle;

import com.github.kaktushose.jda.commands.annotations.interactions.Choices;
import com.github.kaktushose.jda.commands.annotations.interactions.Interaction;
import com.github.kaktushose.jda.commands.annotations.interactions.Param;
import com.github.kaktushose.jda.commands.annotations.interactions.SlashCommand;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import raffel080108.wafflebot.util.SettingsUtils;

@Interaction
public class ToggleModule {
    @SlashCommand(value = "togglemodule", desc = "Toggles a module of the bot for this server", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)
    public void toggleModuleCommmand(CommandEvent event,
                                     @Param(name = "module", value = "The module to toggle")
                                     @Choices({"Auto-Delete", "Message-Logs"}) String module) {
        Boolean newValue = SettingsUtils.toggleSetting(SettingsUtils.SettingsType.GUILD, event.getGuild().getIdLong(),
                module.toLowerCase().replace("-", "") + "_enabled");

        if (newValue == null)
            event.reply(":no_entry_sign: An error occurred");
        else if (newValue)
            event.reply(":white_check_mark: Module `" + module + "` has been **enabled**");
        else
            event.reply(":white_check_mark: Module `" + module + "` has been **disabled**");
    }
}

Command 5 (working fine):

package raffel080108.wafflebot.commands;

import com.github.kaktushose.jda.commands.annotations.interactions.Choices;
import com.github.kaktushose.jda.commands.annotations.interactions.Interaction;
import com.github.kaktushose.jda.commands.annotations.interactions.Param;
import com.github.kaktushose.jda.commands.annotations.interactions.SlashCommand;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import raffel080108.wafflebot.util.SettingsUtils;

import java.awt.*;

@Interaction
public class SetEmbedColor {
    @SlashCommand(value = "setembedcolor", desc = "Sets the color that the bot will use for a certain type of embed",
            enabledFor = Permission.ADMINISTRATOR, isGuildOnly = true)
    public void setEmbedColorCommand(CommandEvent event,
                                     @Param(name = "embed-type", value = "The type of embed to change the color for")
                                     @Choices({"Message Deleted", "Message Edited"}) String embedType,
                                     @Param(name = "color", value = "Example: #ffffff (white) or 'default'") String colorString) {
        if (colorString.equalsIgnoreCase("default")) {
            colorString = switch (embedType) {
                case "Message Deleted" -> "#ff0000";
                case "Message Edited" -> "#ffea00";
                default -> throw new IllegalArgumentException("Unexpected value for 'embedType': " + embedType);
            };
        } else {
            try {
                Color.decode(colorString);
            } catch (NumberFormatException e) {
                event.reply(":x: Invalid color");
                return;
            }
        }

        String sqlName = switch (embedType) {
            case "Message Deleted" -> "messagelogs_delete_color";
            case "Message Edited" -> "messagelogs_edit_color";
            default -> throw new IllegalArgumentException("Unexpected value for 'embedType': " + embedType);
        };

        SettingsUtils.updateSetting(SettingsUtils.SettingsType.GUILD, event.getGuild().getIdLong(), sqlName, colorString.toLowerCase());

        event.reply(":white_check_mark: The color for embed-type `" + embedType + "` has been set to `" + colorString.toLowerCase() + "`");
    }
}
Kaktushose commented 1 year ago

Could you also upload the log file with debug level?

raffel080108 commented 1 year ago

Could you also upload the log file with debug level?

Sorry, what exactly do you mean?

raffel080108 commented 1 year ago

If you just mean the console log, there is nothing related that I can see

Using bot-token: "[redacted]"
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
[main] INFO JDA - Login Successful!
[JDA MainWS-WriteThread] INFO WebSocketClient - Connected to WebSocket
[JDA MainWS-ReadThread] INFO JDA - Finished Loading!
=====
Bot online!

Waffle-Bot
1128691947838636194
=====
Kaktushose commented 1 year ago

You need to configure logging and then set the logging level to debug

raffel080108 commented 1 year ago

I don't understand, sorry

raffel080108 commented 1 year ago

Could you explain to me what exactly you mean?

Kaktushose commented 1 year ago

see https://jda.wiki/setup/logging/ for details

raffel080108 commented 1 year ago

Ah yes, there are actual error logs now I believe that means I have also immidiately found the issue

java.lang.IllegalArgumentException: Cannot add required options after non-required options!

Thanks

raffel080108 commented 1 year ago

Solved the issue for most of the commands, although one of them still doesn't register

package raffel080108.wafflebot.commands.addfilter;

import com.github.kaktushose.jda.commands.annotations.interactions.Interaction;
import com.github.kaktushose.jda.commands.annotations.interactions.Optional;
import com.github.kaktushose.jda.commands.annotations.interactions.Param;
import com.github.kaktushose.jda.commands.annotations.interactions.SlashCommand;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import raffel080108.wafflebot.util.FilterUtils;

@Interaction
public class AddAllFilter {
    @SlashCommand(value = "addtextfilter", desc = "Filter deletes all messages", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)
    public void addAllFilterCommand(CommandEvent event,
                                    @Param(name = "channel", value = "The channel to add the filter to") @Optional TextChannel channel) {
        if (channel == null)
            channel = event.getTextChannel();

        FilterUtils.registerFilterWithChecks(event, channel.getIdLong(), "all");
    }
}

I don't see an error related to this command in the log

"C:\Program Files\Java\jdk-20\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.1.1\lib\idea_rt.jar=57169:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.1.1\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Computer\Java\WaffleBot\target\classes;C:\Users\raffe\.m2\repository\net\dv8tion\JDA\5.0.0-beta.13\JDA-5.0.0-beta.13.jar;C:\Users\raffe\.m2\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;C:\Users\raffe\.m2\repository\com\neovisionaries\nv-websocket-client\2.14\nv-websocket-client-2.14.jar;C:\Users\raffe\.m2\repository\com\squareup\okhttp3\okhttp\4.10.0\okhttp-4.10.0.jar;C:\Users\raffe\.m2\repository\com\squareup\okio\okio-jvm\3.0.0\okio-jvm-3.0.0.jar;C:\Users\raffe\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.5.31\kotlin-stdlib-jdk8-1.5.31.jar;C:\Users\raffe\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.5.31\kotlin-stdlib-jdk7-1.5.31.jar;C:\Users\raffe\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.5.31\kotlin-stdlib-common-1.5.31.jar;C:\Users\raffe\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.6.20\kotlin-stdlib-1.6.20.jar;C:\Users\raffe\.m2\repository\club\minnced\opus-java\1.1.1\opus-java-1.1.1.jar;C:\Users\raffe\.m2\repository\club\minnced\opus-java-api\1.1.1\opus-java-api-1.1.1.jar;C:\Users\raffe\.m2\repository\net\java\dev\jna\jna\4.4.0\jna-4.4.0.jar;C:\Users\raffe\.m2\repository\club\minnced\opus-java-natives\1.1.1\opus-java-natives-1.1.1.jar;C:\Users\raffe\.m2\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar;C:\Users\raffe\.m2\repository\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;C:\Users\raffe\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar;C:\Users\raffe\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar;C:\Users\raffe\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar;C:\Users\raffe\.m2\repository\com\github\kaktushose\jda-commands\4.0.0-alpha.2\jda-commands-4.0.0-alpha.2.jar;C:\Users\raffe\.m2\repository\org\reflections\reflections\0.10.2\reflections-0.10.2.jar;C:\Users\raffe\.m2\repository\org\javassist\javassist\3.28.0-GA\javassist-3.28.0-GA.jar;C:\Users\raffe\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\raffe\.m2\repository\com\google\code\gson\gson\2.10.1\gson-2.10.1.jar;C:\Users\raffe\.m2\repository\org\jetbrains\annotations\24.0.1\annotations-24.0.1.jar;C:\Users\raffe\.m2\repository\org\xerial\sqlite-jdbc\3.42.0.0\sqlite-jdbc-3.42.0.0.jar;C:\Users\raffe\.m2\repository\commons-io\commons-io\2.13.0\commons-io-2.13.0.jar;C:\Users\raffe\.m2\repository\com\github\ben-manes\caffeine\caffeine\3.1.8\caffeine-3.1.8.jar;C:\Users\raffe\.m2\repository\org\checkerframework\checker-qual\3.37.0\checker-qual-3.37.0.jar;C:\Users\raffe\.m2\repository\com\google\errorprone\error_prone_annotations\2.21.1\error_prone_annotations-2.21.1.jar;C:\Users\raffe\.m2\repository\ch\qos\logback\logback-classic\1.2.9\logback-classic-1.2.9.jar;C:\Users\raffe\.m2\repository\ch\qos\logback\logback-core\1.2.9\logback-core-1.2.9.jar raffel080108.wafflebot.WaffleBot
Using bot-token: "[redacted]"
16:17:05.556 JDA RateLimit-Worker 1                        Requester       DEBUG  Received response with following cf-rays: [7f9304a34b1a7a40-DUS]
16:17:05.701 JDA RateLimit-Worker 1                        RestRateLimiter DEBUG  Caching bucket hash GET/users/@me -> f7ead6a7674e5a323d93786263b66cb1
16:17:05.704 main                                          JDA             INFO   Login Successful!
16:17:05.741 main                                          SessionControll DEBUG  Creating new worker handle for shard pool 0
16:17:05.741 main                                          SessionControll DEBUG  Running worker
16:17:05.742 ConcurrentSessionController-Worker            SessionControll DEBUG  Running connect node for shard JDA.ShardInfo(currentShard=[0 / 1], totalShards=1)
16:17:05.743 main                                          JDACommands     INFO   Starting JDA-Commands...
16:17:05.746 main                                          DependencyInjec DEBUG  Indexing dependency providers...
16:17:05.800 main                                          Reflections     INFO   Reflections took 43 ms to scan 1 urls, producing 1 keys and 9 values
16:17:05.808 main                                          FilterRegistry  DEBUG  Registered filter com.github.kaktushose.jda.commands.dispatching.filter.impl.UserMuteFilter for position BEFORE_ROUTING
16:17:05.808 main                                          FilterRegistry  DEBUG  Registered filter com.github.kaktushose.jda.commands.dispatching.filter.impl.PermissionsFilter for position BEFORE_ADAPTING
16:17:05.808 main                                          FilterRegistry  DEBUG  Registered filter com.github.kaktushose.jda.commands.dispatching.filter.impl.DirectMessageFilter for position BEFORE_ADAPTING
16:17:05.808 main                                          FilterRegistry  DEBUG  Registered filter com.github.kaktushose.jda.commands.dispatching.filter.impl.CooldownFilter for position BEFORE_ADAPTING
16:17:05.809 main                                          FilterRegistry  DEBUG  Registered filter com.github.kaktushose.jda.commands.dispatching.filter.impl.ConstraintFilter for position BEFORE_EXECUTION
16:17:05.810 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.ByteAdapter for type java.lang.Byte
16:17:05.810 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.ShortAdapter for type java.lang.Short
16:17:05.810 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.IntegerAdapter for type java.lang.Integer
16:17:05.810 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.LongAdapter for type java.lang.Long
16:17:05.810 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.FloatAdapter for type java.lang.Float
16:17:05.811 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.DoubleAdapter for type java.lang.Double
16:17:05.811 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.CharacterAdapter for type java.lang.Character
16:17:05.811 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.BooleanAdapter for type java.lang.Boolean
16:17:05.811 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.TypeAdapterRegistry$$Lambda$226/0x00000008012768d0 for type java.lang.String
16:17:05.812 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.TypeAdapterRegistry$$Lambda$227/0x0000000801276af0 for type [Ljava.lang.String;
16:17:05.812 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.MemberAdapter for type net.dv8tion.jda.api.entities.Member
16:17:05.812 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.UserAdapter for type net.dv8tion.jda.api.entities.User
16:17:05.813 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.GuildChannelAdapter for type net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
16:17:05.813 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.GuildMessageChannelAdapter for type net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel
16:17:05.813 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.ThreadChannelAdapter for type net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel
16:17:05.813 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.TextChannelAdapter for type net.dv8tion.jda.api.entities.channel.concrete.TextChannel
16:17:05.814 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.NewsChannelAdapter for type net.dv8tion.jda.api.entities.channel.concrete.NewsChannel
16:17:05.814 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.AudioChannelAdapter for type net.dv8tion.jda.api.entities.channel.middleman.AudioChannel
16:17:05.814 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.VoiceChannelAdapter for type net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel
16:17:05.815 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.StageChannelAdapter for type net.dv8tion.jda.api.entities.channel.concrete.StageChannel
16:17:05.815 main                                          TypeAdapterRegi DEBUG  Registered adapter com.github.kaktushose.jda.commands.dispatching.adapter.impl.RoleAdapter for type net.dv8tion.jda.api.entities.Role
16:17:05.819 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.MinimumValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.Min
16:17:05.820 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.MaximumValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.Max
16:17:05.820 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.RoleValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.Role
16:17:05.821 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.NotRoleValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.NotRole
16:17:05.821 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.PermissionValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.Perm
16:17:05.821 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.NotPermissionValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.NotPerm
16:17:05.822 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.UserValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.User
16:17:05.822 main                                          ValidatorRegist DEBUG  Registered validator com.github.kaktushose.jda.commands.dispatching.validation.impl.NotUserValidator for annotation com.github.kaktushose.jda.commands.annotations.constraints.NotUser
16:17:05.826 main                                          DispatcherSuper DEBUG  Registered dispatcher com.github.kaktushose.jda.commands.dispatching.commands.CommandDispatcher for event CommandContext
16:17:05.826 main                                          DispatcherSuper DEBUG  Registered dispatcher com.github.kaktushose.jda.commands.dispatching.buttons.ButtonDispatcher for event ButtonContext
16:17:05.828 main                                          ParserSuperviso DEBUG  Registered parser com.github.kaktushose.jda.commands.dispatching.commands.CommandParser for event SlashCommandInteractionEvent
16:17:05.829 main                                          ParserSuperviso DEBUG  Registered parser com.github.kaktushose.jda.commands.dispatching.buttons.ButtonParser for event ButtonInteractionEvent
16:17:05.829 main                                          ImplementationR DEBUG  Indexing custom implementations...
16:17:05.833 main                                          Reflections     INFO   Reflections took 4 ms to scan 1 urls, producing 0 keys and 0 values
16:17:05.835 main                                          InteractionRegi DEBUG  Indexing controllers...
16:17:05.841 main                                          Reflections     INFO   Reflections took 5 ms to scan 1 urls, producing 1 keys and 10 values
16:17:05.845 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.addfilter.AddTextFilter
16:17:05.858 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='addtextfilter', description=Filter deletes based on text-match, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='type', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='text', constraints=[]}, {java.lang.Boolean, isOptional=true, defaultValue='false', isPrimitive=true, name='is-regex', constraints=[]}, {net.dv8tion.jda.api.entities.channel.concrete.TextChannel, isOptional=true, defaultValue='null', isPrimitive=false, name='channel', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='AddTextFilter.addTextFilterCommand', method=public void raffel080108.wafflebot.commands.addfilter.AddTextFilter.addTextFilterCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,java.lang.String,java.lang.String,boolean,net.dv8tion.jda.api.entities.channel.concrete.TextChannel)}], buttons=[]}
16:17:05.873 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.SetMessageLogsChannel
16:17:05.873 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='setmessagelogschannel', description=Sets the channel that Message-Logs will be sent to, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {net.dv8tion.jda.api.entities.channel.concrete.TextChannel, isOptional=true, defaultValue='null', isPrimitive=false, name='channel', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='SetMessageLogsChannel.setMessageLogsChannelCommand', method=public void raffel080108.wafflebot.commands.SetMessageLogsChannel.setMessageLogsChannelCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,net.dv8tion.jda.api.entities.channel.concrete.TextChannel)}], buttons=[]}
16:17:05.874 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.toggle.ToggleModule
16:17:05.874 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='togglemodule', description=Toggles a module of the bot for this server, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='module', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='ToggleModule.toggleModuleCommmand', method=public void raffel080108.wafflebot.commands.toggle.ToggleModule.toggleModuleCommmand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,java.lang.String)}], buttons=[]}
16:17:05.874 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.addfilter.AddAttachmentsFilter
16:17:05.875 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='addattachmentsfilter', description=Filter deletes based on attachments, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='type', constraints=[]}, {net.dv8tion.jda.api.entities.channel.concrete.TextChannel, isOptional=true, defaultValue='null', isPrimitive=false, name='channel', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='AddAttachmentsFilter.addAttachmentsFilterCommand', method=public void raffel080108.wafflebot.commands.addfilter.AddAttachmentsFilter.addAttachmentsFilterCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,java.lang.String,net.dv8tion.jda.api.entities.channel.concrete.TextChannel)}], buttons=[]}
16:17:05.875 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.EditChannelPermissions
16:17:05.875 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[], buttons=[]}
16:17:05.875 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.FilterModeHelp
16:17:05.875 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='filtermodehelp', description=Shows descriptions about filter-modes, which can be set for channels, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='FilterModeHelp.filterModeHelpCommand', method=public void raffel080108.wafflebot.commands.FilterModeHelp.filterModeHelpCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent)}], buttons=[]}
16:17:05.875 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.addfilter.AddAllFilter
16:17:05.876 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='addtextfilter', description=Filter deletes all messages, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {net.dv8tion.jda.api.entities.channel.concrete.TextChannel, isOptional=true, defaultValue='null', isPrimitive=false, name='channel', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='AddAllFilter.addAllFilterCommand', method=public void raffel080108.wafflebot.commands.addfilter.AddAllFilter.addAllFilterCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,net.dv8tion.jda.api.entities.channel.concrete.TextChannel)}], buttons=[]}
16:17:05.876 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.SetFilterMode
16:17:05.877 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='setfiltermode', description=Sets the filter-mode for a channel, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.Integer, isOptional=false, defaultValue='null', isPrimitive=true, name='filter-mode', constraints=[]}, {net.dv8tion.jda.api.entities.channel.concrete.TextChannel, isOptional=true, defaultValue='null', isPrimitive=false, name='channel', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='SetFilterMode.setFilterModeCommand', method=public void raffel080108.wafflebot.commands.SetFilterMode.setFilterModeCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,int,net.dv8tion.jda.api.entities.channel.concrete.TextChannel)}], buttons=[]}
16:17:05.877 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.toggle.ToggleIgnoreBots
16:17:05.877 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='toggleignorebots', description=Toggles whether bots are ignored by a module of the bot for this server, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='module', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='ToggleIgnoreBots.toggleIgnoreBotsCommand', method=public void raffel080108.wafflebot.commands.toggle.ToggleIgnoreBots.toggleIgnoreBotsCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,java.lang.String)}], buttons=[]}
16:17:05.877 main                                          InteractionRegi DEBUG  Found controller raffel080108.wafflebot.commands.SetEmbedColor
16:17:05.878 main                                          InteractionRegi DEBUG  Registered controller ControllerDefinition{commands=[SlashCommandDefinition{name='setembedcolor', description=Sets the color that the bot will use for a certain type of embed, parameters=[{com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent, isOptional=false, defaultValue='null', isPrimitive=false, name='arg0', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='embed-type', constraints=[]}, {java.lang.String, isOptional=false, defaultValue='null', isPrimitive=false, name='color', constraints=[]}], permissions=[], cooldown={delay=0, timeUnit=MILLISECONDS}, isDM=true, ephemeral=false, id='SetEmbedColor.setEmbedColorCommand', method=public void raffel080108.wafflebot.commands.SetEmbedColor.setEmbedColorCommand(com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent,java.lang.String,java.lang.String)}], buttons=[]}
16:17:05.878 main                                          InteractionRegi DEBUG  Successfully registered 10 controller(s) with a total of 9 interaction(s)!
16:17:05.879 main                                          SlashCommandUpd DEBUG  Updating guild slash commands...
16:17:05.880 main                                          SlashCommandUpd DEBUG  Generated command tree:

16:17:05.881 main                                          SlashCommandUpd DEBUG  Using commands: []
16:17:05.882 main                                          SlashCommandUpd DEBUG  Updating global slash commands...
16:17:05.887 main                                          SlashCommandUpd DEBUG  Generated command tree:

├── filtermodehelp
├── togglemodule
├── addtextfilter
├── addattachmentsfilter
├── setfiltermode
├── setembedcolor
├── setmessagelogschannel
└── toggleignorebots

16:17:05.888 main                                          SlashCommandUpd DEBUG  Using commands: [filtermodehelp, togglemodule, addtextfilter, addattachmentsfilter, setfiltermode, setembedcolor, setmessagelogschannel, toggleignorebots]
16:17:05.914 main                                          SlashCommandUpd DEBUG  Done!
16:17:05.914 main                                          JDACommands     INFO   Finished loading!
16:17:05.975 JDA MainWS-WriteThread                        WebSocketClient INFO   Connected to WebSocket
16:17:05.975 JDA MainWS-WriteThread                        WebSocketClient DEBUG  Connected with gateway intents: 1100011011011011001101
16:17:05.975 JDA MainWS-WriteThread                        WebSocketClient DEBUG  Sending Identify-packet...
16:17:05.980 JDA MainWS-ReadThread                         WebSocketClient DEBUG  Got HELLO packet (OP 10). Initializing keep-alive.
16:17:06.187 JDA MainWS-ReadThread                         GuildSetupContr DEBUG  Setting incomplete count to 1
16:17:06.187 JDA MainWS-ReadThread                         GuildSetupContr DEBUG  Starting 75 second timeout for 1 guilds
16:17:06.205 JDA RateLimit-Worker 2                        Requester       DEBUG  Received response with following cf-rays: [7f9304a69f3b7a40-DUS]
16:17:06.218 JDA RateLimit-Worker 2                        RestRateLimiter DEBUG  Caching bucket hash PUT/applications/{application_id}/commands -> a3b974ef6eb1c925dd4ceb42f4db26fd
16:17:06.241 JDA MainWS-ReadThread                         EntityBuilder   DEBUG  Finished setup for guild with a null owner. GuildId: 1127263363416727643 OwnerId: 686998854134005805
16:17:06.244 JDA MainWS-ReadThread                         JDA             INFO   Finished Loading!
=====
Bot online!

Waffle-Bot
1128691947838636194
=====
16:17:06.246 JDA MainWS-ReadThread                         GuildSetupContr DEBUG  Finished setup for guild 1127263363416727643 firing cached events 0
16:17:35.157 JDA RateLimit-Worker 1                        RestRateLimiter DEBUG  Removed 3 expired buckets
16:18:05.162 JDA RateLimit-Worker 3                        RestRateLimiter DEBUG  Removed 1 expired buckets
Kaktushose commented 1 year ago
16:17:05.887 main                                          SlashCommandUpd DEBUG  Generated command tree:

├── filtermodehelp
├── togglemodule
├── addtextfilter
├── addattachmentsfilter
├── setfiltermode
├── setembedcolor
├── setmessagelogschannel
└── toggleignorebots

16:17:05.888 main                                          SlashCommandUpd DEBUG  Using commands: [filtermodehelp, togglemodule, addtextfilter, addattachmentsfilter, setfiltermode, setembedcolor, setmessagelogschannel, toggleignorebots]
16:17:05.914 main                                          SlashCommandUpd DEBUG  Done!
16:17:05.914 main                                          JDACommands     INFO   Finished loading!
16:17:05.975 JDA MainWS-WriteThread                        WebSocketClient INFO   Connected to WebSocket

Referring to the log file you provided, the addtextfilter command got registered

raffel080108 commented 1 year ago

My bad, I put the wrong command I was talking about the command "addallfilter"

package raffel080108.wafflebot.commands.addfilter;

import com.github.kaktushose.jda.commands.annotations.interactions.Interaction;
import com.github.kaktushose.jda.commands.annotations.interactions.Optional;
import com.github.kaktushose.jda.commands.annotations.interactions.Param;
import com.github.kaktushose.jda.commands.annotations.interactions.SlashCommand;
import com.github.kaktushose.jda.commands.dispatching.commands.CommandEvent;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import raffel080108.wafflebot.util.FilterUtils;

@Interaction
public class AddAllFilter {
    @SlashCommand(value = "addtextfilter", desc = "Filter deletes all messages", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)
    public void addAllFilterCommand(CommandEvent event,
                                    @Param(name = "channel", value = "The channel to add the filter to") @Optional TextChannel channel) {
        if (channel == null)
            channel = event.getTextChannel();

        FilterUtils.registerFilterWithChecks(event, channel.getIdLong(), "all");
    }
}
Kaktushose commented 1 year ago
@SlashCommand(value = "addtextfilter", desc = "Filter deletes all messages", enabledFor = Permission.ADMINISTRATOR,
            isGuildOnly = true)

the command name is addtextfilter, but the class name AddAllFilter

raffel080108 commented 1 year ago

Oh, yea - A simple overseight. The command works now, thanks for the help :)