【发布时间】:2021-01-02 11:31:41
【问题描述】:
我有一个代码需要加入给定频道,但出现以下错误
telethon.errors.rpcerrorlist.ChannelInvalidError:无效的频道对象。确保传递正确的类型,例如确保请求是为频道设计的,或者寻找更适合的不同类型(由 JoinChannelRequest 引起)
我的代码:
group_input = InputChannel(group.id, group.access_hash)
client(JoinChannelRequest(group_input))
我在这里使用 inputChannel,因为我查看了 joinChannelRequest,它要求输入“TypeInputChannel” 它是 [InputChannelEmpty,InputChannel,InputChannelFromMessage] 的并集
我尝试过的另一件事:
1-
client(JoinChannelRequest(group.id))
2-
client(JoinChannelRequest(group))
3-
group_input = InputPeerChannel(group.id, group.access_hash)
client(JoinChannelRequest(group_input))
【问题讨论】:
-
您有想要加入的频道的链接或用户名吗?
-
是的,我有链接
-
但在某些情况下我没有链接或用户名,我也需要处理它,我可能有 id
标签: python python-3.x telegram telethon