如何获取我参加电视马拉松的频道列表?

ami*_*mir 9 python python-2.7 python-3.x telegram telethon

我想制作一个脚本来显示我加入的频道,然后将所有内容保留在以下示例中:

from telethon.tl.functions.channels import LeaveChannelRequest
await client(LeaveChannelRequest(input_channel))
Run Code Online (Sandbox Code Playgroud)

The*_*996 16

为了保留您所在的所有频道,您必须从对话框列表中获取所有频道,然后将其删除。这是一个片段。

async for dialog in client.iter_dialogs():
    if not dialog.is_group and dialog.is_channel:
        await dialog.delete()
Run Code Online (Sandbox Code Playgroud)

  • 尝试“等待 client.get_dialogs()” (2认同)