角色创建命令未响应

时间:2020-09-13 11:37:49

标签: discord.py

我的命令似乎没有响应该命令。还可以使用十六进制值或其他值吗?

  @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")```

1 个答案:

答案 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")