DiscordSRV

DiscordSRV

86.8k Downloads

SlashCommandManager syncing issues

RocketManKian opened this issue ยท 5 comments

commented

Expected behavior

I expect my plugin to be able to successfully register a command using the SlashCommandManager.

Actual behavior

When using a plugin such as InteractiveChatDiscordSRVAddon which uses the new SlashCommandManager, alongside a custom plugin which also uses it to implement different commands, the bot doesn't have any commands that it should.

Example...

If I installed InteractiveChatDiscordSRVAddon without my custom plugin, it would add all those commands such as '/playerlist' etc...

Whereas, if I install both InteractiveChatDiscordSRVAddon and my own plugin, it doesn't add any commands.

Steps to reproduce

  1. Download the latest InteractiveChatDiscordSRVAddon version from here, as it utilizes the same Manager.

  2. Create a listener class, and register it with DiscordSRV.

  3. Within this class, create a DiscordReadyEvent handler via @Subscribe and have the following code within it:

SlashCommandManager slashCommandManager = DiscordSRV.api.getSlashCommandManager();
slashCommandManager.setCommands(<your plugin instance here>, new CommandData("reportbug", "Report a Bug")
    .addOption(OptionType.STRING, "bug", "Specified Bug", true)
    .addOption(OptionType.STRING, "server", "Which Server did you find the Bug on? (Survival, Creative, Skywars, Lobby, All)", true));
slashCommandManager.reloadSlashCommands();
  1. Build the Plugin and install alongside InteractiveChatDiscordSRVAddon (and InteractiveChat, as it's required for ICDSRVA to function) and you will notice that no commands will be added to the bot.

Server software and version

Paper-91 (MC: 1.19.1)

Checks

  • I am not using an outdated version of DiscordSRV.
  • I asked in DiscordSRV's Discord server to see whether this issue is in fact a bug that needs to be fixed.

Anything else

Was recommended to open an issue after a length discussion in the #coding channel on the Discord

commented

Please test with latest development build, https://snapshot.discordsrv.com, it should provide a better error

commented

Please test with latest development build, https://snapshot.discordsrv.com, it should provide a better error

Just updated to this development build on the Server and now I am getting no error whatsoever. The only error I got was this

[13:57:09 ERROR]: [DiscordSRV] DiscordSRV encountered an unknown exception: Cascading failure caused by interaction callback failure
github.scarsz.discordsrv.dependencies.jda.api.exceptions.InteractionFailureException: Cascading failure caused by interaction callback failure
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.internal.requests.restaction.interactions.InteractionCallbackActionImpl.handleResponse(InteractionCallbackActionImpl.java:84)
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.api.requests.Request.handleResponse(Request.java:259)
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.internal.requests.Requester.execute(Requester.java:237)
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.internal.requests.Requester.execute(Requester.java:141)
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.internal.requests.Requester.execute(Requester.java:124)
        at DiscordSRV-Build-1.26.0-SNAPSHOT-99b591b.jar//github.scarsz.discordsrv.dependencies.jda.internal.requests.ratelimit.BotRateLimiter$Bucket.run(BotRateLimiter.java:478)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

[13:57:09 ERROR]: [DiscordSRV] DiscordSRV encountered an unknown Discord error: 10062: Unknown interaction

But I think this is unrelated to the issue. Another weird thing, is it appears the issue is solved after updating to this version, so I'm not sure if you did that intentionally or what :D

commented

That error seems to be unrelated, maybe try waiting and try again - as the commands may not have fully synced up to your Discord client yet

commented

Yeah as of speaking right now all the commands seem to be showing up and working as intended, so this latest Dev Build fixed something. Did you change anything that could've fixed this besides adding further info to errors? Since I'm honestly confused if not haha

commented

No besides the logging changes nothing changed, my guess internally was that you might have hit the 200 command create daily limit