Python 我如何在discordpy中获得机器人(客户端)的最高角色
所以现在我的设置是Python 我如何在discordpy中获得机器人(客户端)的最高角色,python,discord,bots,roles,Python,Discord,Bots,Roles,所以现在我的设置是 if memb.id != 'EzLife#9391' and memb.id != message.guild.owner.id and memb.top_role < client.top_role: 如果memb.id!='EzLife#9391'和memb.id!=message.guild.owner.id和memb.top_角色
if memb.id != 'EzLife#9391' and memb.id != message.guild.owner.id and memb.top_role < client.top_role:
如果memb.id!='EzLife#9391'和memb.id!=message.guild.owner.id和memb.top_角色
但问题是,客户端是一个bot,而bot没有最高角色。我试图通过执行client.me.top_角色获得bot的成员,但我没有获得任何top角色。有任何修复吗?目前,在最新版本的discord.py中,没有
client.me
下面是一些您可以做的事情(使用discord.ext的命令
):
member=ctx.guild.get_成员(client.user.id)
top\u角色=member.top\u角色
top\u role
将返回discord.role
,因此您可以执行top\u role.name
,top\u role.id
等操作
您可以在此处查看文档:
您还可以加入discordpy discord以获取更多帮助: