python - 如何获取我在 Telethon 中加入的频道列表?
问题描述
我想制作一个脚本来显示我加入的频道,然后将所有这些都留在这个例子中:
from telethon.tl.functions.channels import LeaveChannelRequest
await client(LeaveChannelRequest(input_channel))
解决方案
为了离开您所在的所有频道,您必须从对话框列表中获取所有频道,然后删除它们。这是一个片段。
async for dialog in client.iter_dialogs():
if not dialog.is_group and dialog.is_channel:
await dialog.delete()
推荐阅读
- python - 如何根据数据框中的条件更改行的值?
- python - python用matplotlib同时绘制多个直方图
- amazon-web-services - 写入 s3 上的重复分区列
- r - brms 家庭二项式:公式试验的奇怪行为?错误:...需要整数响应
- swift - 如何制作可编码类来解码没有键/名称的json数组?
- delphi - 无法将变体类型(数组变体)转换为类型(OleStr)
- r - R markdown pdf更改并排表的标题标签
- excel - 需要代码将特定值从工作表上的表格中的选定行复制并粘贴到另一个表格中的单元格
- angular - 在订阅方法中将数据分配给变量后,一旦方法完成,数据就会消失
- javascript - 将来自 2 个不同 div 的两个值相加不工作