【发布时间】:2022-09-27 22:49:33
【问题描述】:
我试图在我的机器人的异步函数中循环,对于自动销毁函数,我必须迭代所有用户并检查用户是否是管理员,使用以下代码完成:
all_participants = await bot.get_participants(group, aggressive=False)
admins = bot.iter_participants(group, filter=ChannelParticipantsAdmins)
print(\'[+] Banno gli utenti...\')
async for user in all_participants:
if not user in admins:
pass
当我尝试运行我的代码时出现问题,返回此错误
Traceback (most recent call last):
File \"/home/elias/.local/lib/python3.8/site-packages/telethon/client/updates.py\", line 467, in _dispatch_update
await callback(event)
File \"bannerbot.py\", line 31, in pyro
async for user in all_participants:
TypeError: \'async for\' requires an object with __aiter__ method, got TotalList
有什么解决办法吗?
标签: python bots telegram telethon