I recently updated my discord.py and it seems some of my older commands are wrong. I need to loop through all the members of a discord server but the old way I did it does not work anymore. Heres my old code.
@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)
this is the part of the code that doesnt work, I dont know what the new way to loop through all the members of the server is since for member in message.server.members: doesnt work anymore. Thank you for help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…