我想用 discord.py 创建一个配置文件命令,我希望嵌入消息具有成员的最高角色颜色。我的代码:@client.command(passContent=True)@commands.has_role("🍿║Участники")async def профиль(ctx, member: discord.Member): colour=member.Colour.default() профиль_сообщение=discord.Embed( title=f'Профиль {ctx.author.name}', colour=colour ) await ctx.send(embed=профиль_сообщение)错误:discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'Colour'
1 回答

智慧大石
TA贡献1946条经验 获得超3个赞
Member.top_role
这可以通过使用Role.colour
属性来完成
其他需要注意的事项:
passContent
不是东西,pass_context
但重写时不需要
@client.command()
@commands.has_role("🍿║Участники")
async def профиль(ctx, member: discord.Member):
профиль_сообщение=discord.Embed(
title=f'Профиль {ctx.author.name}',
colour=member.top_role.colour
)
await ctx.send(embed=профиль_сообщение)
添加回答
举报
0/150
提交
取消