重写分支提供了一个attribute
Role.members。
在异步分支上,您必须遍历服务器的所有成员并检查其角色。
@bot.command(pass_context=True) async def getuser(ctx, role: discord.Role): role = discord.utils.get(ctx.message.server.roles, name="mod") if role is None: await bot.say('There is no "mod" role on this server!') return empty = True for member in ctx.message.server.members: if role in member.roles: await bot.say("{0.name}: {0.id}".format(member)) empty = False if empty: await bot.say("Nobody has the role {}".format(role.mention))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)