我的命令似乎没有响应该命令。还可以使用十六进制值或其他值吗?
@commands.command()
async def rolecreate(self, ctx, rolename, rolecolour):
guild = ctx.guild
await guild.create_role(name=f"{rolename}", colour=discord.Colour(rolecolour))
await ctx.send(f"{rolename} role with the colour {rolecolour} has been created")```
答案 0 :(得分:0)
您需要一个int
,但您要传递一个str
,请在Colour
参数中指定rolecolour
类:
@commands.command()
async def rolecreate(self, ctx, rolecolour: discord.Colour, *, rolename):
guild = ctx.guild
await guild.create_role(name=f"{rolename}", colour=rolecolour)
await ctx.send(f"{rolename} role with the colour {rolecolour} has been created")