Search code examples
pythondiscorddiscord.pypycord

400 Bad Request in Pycord on_connect()


So, I recently ported my bot to Slash Commands, since that's a thing now, but whenever I run it it throws discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body. Same happens when I run any command.
The code is here.
The full error trace of both on_connect() and the commands are here.

Some people says it's because their message is too large, but I'm not even sending a message. The error gets thrown as soon as I execute the bot.


Solution

  • The problem is basically in the error message itself:

    Required options must be placed before non-required options

    You can't have optional arguments before required arguments, which is the case in a few of your commands, for example mute. By defining the argument silent with a default value (False) you make it optional, but then you add another argument reason, which isn't optional, which isn't allowed by discord. To fix this, you can make silent a required argument, by removing =False