【发布时间】:2022-09-27 22:51:18
【问题描述】:
我正在尝试实现一个具有自动销毁功能的机器人,并且正如在另一个讨论中所建议的那样,我正在尝试仅使用 telethon api。但是当我试图让所有用户进入这样的列表时:
chats = []
last_date = None
chunk_size = 900
groups=[]
result = bot(GetDialogsRequest(
offset_date=last_date,
offset_id=0,
offset_peer=InputPeerEmpty(),
limit=chunk_size,
hash = 0
))
await chats.extend(result.chats)
print(\'[+] scegli il gruppo dove vuoi bannare gli utenti:\')
i=0
for g in groups:
print(\'[\' + str(i) + \']\' + \' - \'+ g.title )
i+=1
g_index = input(\"inserisci il numero del gruppo scelto: \")
target_group=groups[int(g_index)]
print(\"Seleziono gli utenti...\")
time.sleep(1)
all_participants = []
all_participants = await bot.get_participants(target_group, aggressive=False)
但它返回此错误,说我不能在机器人中使用 getDialogsRequest
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetDialogsRequest)
我不知道如何访问除管理员以外的用户列表,有什么想法吗?
标签: python api bots telegram telethon