Python &引用;discord.ext.commands.errors.CommandInvokeError:Command引发异常:HTTPException:400错误请求“;创建角色时
我正在制作一个创建角色的命令,代码如下:Python &引用;discord.ext.commands.errors.CommandInvokeError:Command引发异常:HTTPException:400错误请求“;创建角色时,python,discord,discord.py,Python,Discord,Discord.py,我正在制作一个创建角色的命令,代码如下: @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 e
@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.
您没有获得有效的名称,在
*
和名称之间有一个额外的空格
请阅读更多
@client.command()
@拥有\u权限(管理员=True)
异步def createrole(ctx,*名称):
等待ctx.guild.create_角色(name=name)
你忘了一个逗号。谢谢,我没注意到