如何使用角色颜色制作嵌入消息



我想让嵌入消息的颜色:role:

@client.command(passContent=True)
async def role(ctx):
role=discord.utils.find(lambda r: r.id == 804318858873536522, ctx.message.guild.roles)
embed=discord.Embed(title=f'{role}', colour={role.color})
await ctx.send(embed=embed)

当我执行命令时,我得到这个:

Command raised an exception: TypeError: Expected discord.Colour, int, or Embed.Empty but received set instead.

删除角色前后{}。颜色和它应该工作,加上{}使它成为一个集合

@client.command()
async def role(ctx):
role = discord.utils.find(lambda r: r.id == 804318858873536522, ctx.message.guild.roles)
embed = discord.Embed(title=f'{role}', colour=role.color)
await ctx.send(embed=embed)

最新更新