scarletcafe / jishaku

A debugging and testing cog for discord.py rewrite bots.
https://jishaku.readthedocs.io/en/latest/
MIT License
543 stars 182 forks source link

jsk sync is broken #166

Closed Motzumoto closed 2 years ago

Motzumoto commented 2 years ago

Summary

jsk sync is broken, gives an error

Reproduction steps

try to sync something

Expected results

to sync my bot tree

Actual results

gives an error

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 191, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/jishaku/features/management.py", line 203, in jsk_sync
    synced = await self.bot.tree.sync()
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 923, in sync
    data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/http.py", line 501, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 64.description: Must be between 1 and 100 in length.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.9/site-packages/jishaku/features/invocation.py", line 146, in jsk_debug
    await alt_ctx.command.invoke(alt_ctx)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1548, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 939, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/ubuntu/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 200, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 64.description: Must be between 1 and 100 in length.

Checklist

System information

Name: discord.py Version: 2.0.0a4147+g1d97a353 Summary: A Python wrapper for the Discord API Home-page: https://github.com/Rapptz/discord.py Author: Rapptz Author-email: None License: MIT Location: /home/ubuntu/.local/lib/python3.9/site-packages Requires: aiohttp Required-by: wavelink, topggpy, discord-ext-menus, discord-argparse, dblpy, buttons [status] Return code 0

Name: jishaku -- 4 | Version: 2.4.0a403+g8bc4ed4.master 5 | Summary: A discord.py extension including useful tools for bot development and debugging. 6 | Home-page: https://github.com/Gorialis/jishaku 7 | Author: Devon (Gorialis) R 8 | Author-email: None 9 | License: MIT 10 | Location: /home/ubuntu/.local/lib/python3.9/site-packages 11 | Requires: typing-extensions, click, importlib-metadata, import-expression, braceexpand 12 | Required-by:
scarletcafe commented 2 years ago

This is an error with one of your commands, not with sync. It seems proper error handling for this case doesn't happen with global commands (instead of guilds). I'm probably going to rework the sync command entirely since there's other stuff I want to fix with it as well.

Motzumoto commented 2 years ago

Im not sure how this could be an issue with my commands, i have error handling for them and normally when i reload a cog it will say whats wrong with it, image and as you can see, theres no issues with my cogs

scarletcafe commented 2 years ago

It has to be an issue with your commands - because this is specifically a sync issue with slash commands, and jishaku has none. It's saying that the description of the 64th command pushed into the payload is either too long or empty, so you have to figure out what that command is. I think in my rework I'm going to make the sync process step around the lib's impl so it can infer where these come from.

Motzumoto commented 2 years ago

Im having no issues with any of my commands so i cant figure out where this issue is coming from at all. maybe its an issue with hybrid_commands? I didnt have this issue when i was using basic app_commands, maybe its that?

scarletcafe commented 2 years ago

Try using

pip install -U git+https://github.com/Gorialis/jishaku@features/better-sync

to download my in-progress sync command version. It should correctly handle global command sync errors, and attempt to diagnose the source of form body errors. Let me know how it goes.

RGBCube commented 2 years ago

Im not sure how this could be an issue with my commands, i have error handling for them and normally when i reload a cog it will say whats wrong with it, image and as you can see, theres no issues with my cogs

reloading cogs dont sync commands automatically

Motzumoto commented 2 years ago

So I figured out the issue, turns out app commands cant have a description longer than 100 characters, but app command sub commands can, so it took me a good few days to figure that out

scarletcafe commented 2 years ago

Did the new diagnostic help?

Motzumoto commented 2 years ago

Did the new diagnostic help?

I was unable to test as i was actively working on fixing the issue before I read this issue, but I will definitely let you know if the new diagnostic helps