一旦我知道了,我就可以通过channels.getMessages请求成功地从频道中检索消息message IDs.顺便说一句,我通过contacts.search查找频道ID .
目前,消息ID是连续的整数,因此获取max_id可以解决问题.
我确信这是可能的,因为官方客户这样做(查看频道而不加入它).我将尝试通过阅读其来源了解官方桌面应用程序如何做到这一点,但任何帮助将不胜感激.
我需要这个,因为我正在写一个简单的公共电报频道 - > rss/web界面.
请不要将电报API与电报机器人API混淆.Bot API允许在新消息上接收"推送"消息,但没有"读取历史日志".
以下是您从未加入的频道收到邮件时必须执行的步骤:
contacts.resolveUsernamemessages.getHistory以获取所需的消息.以下是messages.getHistory参数的简短说明:
:param peer: The channel from whom to retrieve the message history
:param limit: Number of messages to be retrieved
:param offset_date: Offset date (messages *previous* to this date will be retrieved)
:param offset_id: Offset message ID (only messages *previous* to the given ID will be retrieved)
:param max_id: All the messages with a higher (newer) ID or equal to this will be excluded
:param min_id: All the messages with a lower (older) ID or equal to this will be excluded
:param add_offset: Additional message offset (all of the specified offsets + this offset = older messages)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9742 次 |
| 最近记录: |