'I am getting error 400 Bad Request (error code: 50035): Invalid Form Body In 0.options.0.name: Command name is invalid discord.py
I'm making a bot in discord using slash commands and when compiling it gives an error.Considering that I am writing a response to the "function" command, it gives an error
Error Code:
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<SlashCommand.sync_all_commands() done, defined at C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_slash\client.py:416> exception=HTTPException('400 Bad Request (error code: 50035): Invalid Form Body\nIn 0.options.0.name: Command name is invalid')>
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_slash\client.py", line 492, in sync_all_commands
raise ex
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_slash\client.py", line 472, in sync_all_commands
existing_cmds = await self.req.put_slash_commands(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 357, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In 0.options.0.name: Command name is invalid
My Code
import discord
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option
import config
client = commands.Bot(command_prefix="!")
slash = SlashCommand(client, sync_commands=True)
token = "my token"
@client.event
async def on_ready():
print('Запустился :) //by YASHER')
@slash.slash(name = 'invite', description = '[Отчет о принятии] Принятие человека в семью', options = [{
"name": "Пользователь",
"description": "Тег человека которого вы приняли",
"type": 6,
"required": True,
},
{
"name": "причина",
"description": "причина",
"type": 3,
"requied": True,
}], guild_ids = [824998118595887165])
async def invite(ctx, Пользователь: discord.Member = None):
await ctx.send(f"П, {Пользователь}!")
client.run(token)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
