gpt4 book ai didi

python - 在 python telethon 中加入 channel 的最简单方法

转载 作者:太空宇宙 更新时间:2023-11-03 15:53:35 29 4
gpt4 key购买 nike

我阅读电视节目文档到 retrieve an user-namejoin a channel .经过一些尝试,我写了这段代码:

result = client.invoke(ResolveUsernameRequest('XXXX'))
channel = InputChannel(result.peer.channel_id, result.chats[0].access_hash)
client.invoke(JoinChannelRequest(channel))

这段代码工作正常,但我想知道是否有更好或更简单的方法?

最佳答案

第一次升级电视节目

from telethon.tl.functions.messages import ImportChatInviteRequest
updates = client(ImportChatInviteRequest('hash_invite _channel'))

关于python - 在 python telethon 中加入 channel 的最简单方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44996317/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com