AdminRoles = ["Moderation","Administration","Emperor"]
@client.command()
async def Commands(ctx):
member = ctx.author
if AdminRoles in member.roles:
ShowCommand = discord.Embed(
title = "Moderation Commands",
description = "All commands",
colour = discord.Colour.red()
)
await ctx.send(embed = ShowCommand)
else:
ShowCommand = discord.Embed(
title = "Member Commands",
description = "All commands",
colour = discord.Colour.red()
)
await ctx.send(embed = ShowCommand)
我确实修复了上面的代码,因为当我输入命令时,它会一直显示普通的播放器命令,并且它应该显示Mod命令
在代码中,您执行了
if AdminRoles in member.roles:
。这意味着if成员拥有所有的AdminRoles
。因此,您可以按如下方式更改代码:在这段代码中,若成员有
AdminRoles
中的任何一个,则会发送调节命令您正在查看列表
AdminRoles
是否在member.roles中,整个列表如下所示:但您希望AdminRoles中的一个项位于members.role内,因此需要类似以下内容:
(最后检查adminRoles中是否至少有一个角色在member.roles中)
相关问题 更多 >
编程相关推荐