我想用角色的颜色制作嵌入消息:
@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.
答案 0 :(得分:2)
在 role.color 之前和之后删除 {},它应该可以工作,放入 {} 使它成为一个集合
@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)