dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
683 stars 162 forks source link

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body #365

Closed someuser32 closed 2 years ago

someuser32 commented 2 years ago

Summary

Invalid Form Body when sending slash-command

Reproduction Steps

  1. python test.py

Code

import discord, asyncio

client = discord.Client()

@client.event
async def on_ready():
    print(f"{client.user.name} is ready!")
    channel = client.get_channel(CHANNEL_ID)
    if channel is not None:
        print("channel is not none")
        async for cmd in channel.slash_commands(query="ping"):
            if cmd.name == "ping":
                print("slash found")
                await asyncio.sleep(1)
                print("sending slash")
                try:
                    await cmd()
                except discord.Forbidden as e:
                    print(f"i have no permissions {repr(e)}")
                break
        else:
            print("i didnt found slash")
    else:
        print("channel is none")
    await asyncio.sleep(3)
    await client.close()

client.run(TOKEN)

Expected Results

client uses /ping

Actual Results

Traceback (most recent call last): File "D:\Python\prj\discord\client.py", line 381, in _run_event await coro(*args, *kwargs) File "D:\Python\prj\test.py", line 17, in on_ready await cmd() return await super().call(self._parse_kwargs(kwargs), channel) File "D:\Python\prj\discord\commands.py", line 273, in call return await super().call(data, files, channel) File "D:\Python\prj\discord\commands.py", line 116, in call await state.http.interact(type, data, acc_channel, files=files, nonce=nonce, application_id=self.application_id) File "D:\Python\prj\discord\http.py", line 580, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In data: Invalid interaction application command

System Information

Checklist

Additional Information

No response

dolfies commented 2 years ago

This should be fixed now.