我有一个代码,我需要加入一个给定的通道,但得到以下错误
telethon.errors.rpcerrorlist.ChannelInvalidError: Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited (caused by 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))
最简单的方法是检索公共频道的用户名
假设频道的用户名为
@The_Channel
获取实体
entity = client.get_entity("t.me/The_Channel") #omit @
然后调用此函数
client(JoinChannelRequest(entity))
相关问题 更多 >
编程相关推荐