2 回答

TA貢獻(xiàn)1943條經(jīng)驗(yàn) 獲得超7個(gè)贊
在您的代碼中,您做到了if AdminRoles in member.roles:。這意味著如果成員擁有所有AdminRoles. 所以你可以像這樣改變你的代碼:
AdminRoles = ["Moderation","Administration","Emperor"]
@client.command()
async def Commands(ctx):
member = ctx.author
for role in member.roles:
if role.name in AdminRoles:
ShowCommand = discord.Embed(
title = "Moderation Commands",
description = "All commands",
colour = discord.Colour.red()
)
await ctx.send(embed = ShowCommand)
return
ShowCommand = discord.Embed(
title = "Member Commands",
description = "All commands",
colour = discord.Colour.red()
)
await ctx.send(embed = ShowCommand)
在此代碼中,如果成員有任何一個(gè)AdminRoles,則將發(fā)送審核命令。

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個(gè)贊
您正在查看列表是否AdminRoles在 member.roles 內(nèi)部,整個(gè)列表如下:
if ["a","b","m"] in members.roles:
但您希望 AdminRoles 中的一項(xiàng)位于 Members.role 內(nèi)部,因此您需要類似以下內(nèi)容:
test = [e for e in AdminRoles if e in members.roles]
if len(test) > 0:
doTheRightModeratorThing()
else:
doTheRightCommonerThing()
(最后檢查 adminRoles 中是否至少有一個(gè)角色位于 member.roles 中)
添加回答
舉報(bào)