首页 > 解决方案 > 如何获取我在 Telethon 中加入的频道列表?

问题描述

我想制作一个脚本来显示我加入的频道,然后将所有这些都留在这个例子中:

from telethon.tl.functions.channels import LeaveChannelRequest
await client(LeaveChannelRequest(input_channel))

标签: pythonpython-3.xpython-2.7telegramtelethon

解决方案


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

async for dialog in client.iter_dialogs():
    if not dialog.is_group and dialog.is_channel:
        await dialog.delete()

推荐阅读