python - 如何获取我的不和谐机器人拥有的所有角色的列表?
问题描述
我正在尝试获取我的机器人从上到下的所有角色的列表,以便我可以获得最高角色的颜色。
解决方案
@bot.command()
async def get_roles(ctx):
all_roles = []
for role in ctx.guild.roles:
all_roles.append(role.name)
all_roles.reverse()# to make it higher first
print(all_roles)
推荐阅读
- python - 如何将 django 模型导入外部 python 脚本
- python - 如何将此 Python 变量分配给我正在循环的列表?
- python - 纸浆最小化选择的加权平均值
- google-cloud-run - 如何从 Cloud Run 提供预压缩文件?
- python - 如何知道python中函数和方法的隐藏代码
- python - 如何从另一个 python 脚本启动 Django 应用程序
- javascript - ReactJS + SVG:点击 FireFox 的动画路径“d”
- c# - 如何转换为 JsonObject 并将其绑定到 C# 中的模型类?
- django - 如何检查 Django 模型的属性和字段
- ios - 是否可以从 wkwebview 中经过身份验证的会话下载 pdf?