所以现在我的设置是
if memb.id != 'EzLife#9391' and memb.id != message.guild.owner.id and memb.top_role < client.top_role:
但是问题是客户端是机器人,而机器人没有最高角色。我试图通过做client.me.top_role来获得机器人的成员,但是我没有得到任何最高职位。有任何解决办法吗?
答案 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.name
、top_role.id
等
您可以在此处查看文档:{{3}}
您也可以加入 discordpy discord 以获得更多帮助:https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.top_role