python - 如何使用 Telethon 从频道 ID 获取参与者
问题描述
我正在尝试将 GetParticipantsRequest() 与第一个参数一起用作文档:
channel - InputChannel - 如果库可以找到其输入版本(例如,用户名、Peer、User 或 Channel 对象等),任何类似实体的东西都可以工作
我的代码:
newInputChannel = InputChannel(channelId, channelHash)
all_participants = await client(functions.channels.GetParticipantsRequest(
newInputChannel,
filter=types.ChannelParticipantsRecent(),
offset=42,
limit=100,
hash=0
))
但我得到错误:
telethon.errors.rpcerrorlist.ChannelInvalidError:无效的通道对象。确保传递正确的类型,例如确保请求是为通道设计的,或者寻找更适合的不同类型(由 GetParticipantsRequest 引起)
该组是私人的,所以它没有用户名,但我还是得到了 GROUP_ID 和 GROUP_HASH,我怎样才能得到所有成员的列表?
谢谢
解决方案
推荐阅读
- loops - awk 语法 '||' 没有'if' - 它是如何工作的,为什么它会循环?
- android - 如何在活动旋转时保存/恢复 MotionLayout 的状态
- c - 我的代码“忽略”多个正确的显示并选择它捕获的第一个
- c# - 使用回调调用本机代码时出现 System.EngineExecutionException
- symfony - 从 Symfony 中的动态 ID 获取服务
- mysql - 为什么我的 SQL 查询会产生不同的顺序?
- python - 将列表转换为字典,其中列表值为字典键和值
- node.js - 没有找到kurento utils?
- circleci - Sentry --rewrite 选项失败的命令
- python - python理解API的问题