【问题标题】:How to make embed message with role colour如何使用角色颜色制作嵌入消息
【发布时间】:2021-02-01 01:09:23
【问题描述】:

我想用角色颜色制作嵌入消息:

@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.

【问题讨论】:

    标签: python python-3.x discord discord.py


    【解决方案1】:

    在 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-22
      • 1970-01-01
      • 2019-06-03
      • 2021-02-05
      • 1970-01-01
      • 2020-08-06
      • 2021-07-19
      • 2021-01-30
      相关资源
      最近更新 更多