首页 > 解决方案 > chat.megagroup 未显示 Telethon 中的所有组

问题描述

我正在使用chat.megagroup==true 它没有显示所有频道(在 中m==1),并且它也有问题,例如有时会显示 A 组和 B 组,有时会显示 A 或 B,有时会显示 C 组,不知道为什么会这样甚至无需更改代码中的任何内容即可发生。

该脚本总体上运行良好,但唯一的问题是我有时没有需要使用的组。

result = client(GetDialogsRequest(
             offset_date=last_date,
             offset_id=0,
             offset_peer=InputPeerEmpty(),
             limit=chunk_size,
             hash = 0))

chats.extend(result.chats)
dialogs = client.get_dialogs()

m = input("1: For only permitted groups \n2: For all groups\n")
if m=='1':
    for chat in chats:
        try:
            if chat.megagroup == True:
                groups.append(chat)
        except:
            continue
elif m=='2':
    for i in dialogs:
        try:
            i.entity.status
        except:
            groups.append(i)
            continue

m==2中,显示了所有组。你能指导我做错了什么还是别的什么?

标签: pythontelegramtelethon

解决方案


推荐阅读