我如何在不和谐中获得bot(客户端)的最高角色

时间:2020-10-20 09:23:31

标签: python discord bots roles

所以现在我的设置是

       if memb.id != 'EzLife#9391' and memb.id != message.guild.owner.id and memb.top_role < client.top_role:

但是问题是客户端是机器人,而机器人没有最高角色。我试图通过做client.me.top_role来获得机器人的成员,但是我没有得到任何最高职位。有任何解决办法吗?

1 个答案:

答案 0 :(得分:0)

截至目前,在最新版本的 discord.py 中,没有 client.me 不过,您可以执行以下操作(使用 discord.ext's commands):

member = ctx.guild.get_member(client.user.id)
top_role = member.top_role

top_role 将返回 discord.Role,因此您可以执行 top_role.nametop_role.id

您可以在此处查看文档:{​​{3}}

您也可以加入 discordpy discord 以获得更多帮助:https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.top_role