"discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Ba



我正在制作一个创建角色的命令,这是代码:

@client.command()
@has_permissions(administrator=True)
async def createrole(ctx, * name):
guild = ctx.guild
await guild.create_role(name=name)

但当我运行它时,它告诉我:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In name: Could not interpret "[New Role]" as string.

您没有得到有效的名称,*name之间有一个额外的空格。

请在这里阅读更多

@client.command()
@has_permissions(administrator=True)
async def createrole(ctx, *name):
await ctx.guild.create_role(name=name)

相关内容

最新更新