【发布时间】:2019-10-24 11:06:24
【问题描述】:
我最近更新了我的 discord.py,但我的一些旧命令似乎是错误的。我需要遍历不和谐服务器的所有成员,但是我这样做的旧方法不再起作用。这是我的旧代码。
@bot.command(pass_context = True)
async def missing(ctx, channel : str = None, useDiscordID : bool = False):
memberlist = []
for member in message.server.members:
toAppend = ''
if "barcode" in [y.name.lower() for y in member.roles]:
if member.nick is None:
toAppend = member.name
else:
toAppend = member.nick
if useDiscordID:
toAppend = f'{str(member)} : {toAppend}'
memberlist.append(toAppend)
这是代码中不起作用的部分,我不知道循环服务器所有成员的新方法是什么,因为 message.server.members 中的成员:不再起作用。谢谢你的帮助!
【问题讨论】:
-
你能发布相关异常吗?
标签: python discord discord.py