【问题标题】:How to get all the pinned messages in a telegram chat using pytelegrambotapi?如何使用 pytelegrambotapi 在电报聊天中获取所有固定消息?
【发布时间】:2022-01-25 02:52:36
【问题描述】:

我正在尝试为我的机器人检索电报聊天中的所有固定消息。 从下面的代码

prev_message = bot.get_chat(chat_id).pinned_message.text

我能够检索最近固定的消息。有没有办法将所有固定消息作为一个数组获取? 我正在使用pytelegrambotapi 编写我的机器人。

【问题讨论】:

    标签: python python-3.x telegram telegram-bot py-telegram-bot-api


    【解决方案1】:

    根据官方电报机器人 api 文档,在 chat.pinned_message 中只有最后一个固定的消息。

    最近固定的消息(按发送日期)。仅在 getChat 中返回。

    来源:https://core.telegram.org/bots/api#chat

    所以,由于 pyTelegramBotApi 使用这些 http api,我认为您无法获取所有固定消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-28
      • 1970-01-01
      • 1970-01-01
      • 2018-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多