【问题标题】:How to send message to the user by using telegram id and python_telegram_bot library?如何使用电报 id 和 python_telegram_bot 库向用户发送消息?
【发布时间】:2022-08-15 03:52:59
【问题描述】:

我想通过使用他的电报和 python_telegram_bot 库将消息发送给任何人。 我可以使用以下代码将消息发送给我,但如果我输入其他人的 id,则我无法发送消息,它会显示 chat not found 消息。

updater = Updater(mybot_token, use_context=True)
updater.bot.send_message(chat_id = receiver_id, text=\"welcome\")

我不确定为什么只能将消息发送给我,而不是其他人,即使我将 chat_id 作为他们的电报 ID。

    标签: telegram-bot message python-telegram-bot sendmessage


    【解决方案1】:

    机器人只能向已经启动机器人的用户发送消息。请参阅Telegram Bot docs

    【讨论】:

      猜你喜欢
      • 2017-12-05
      • 1970-01-01
      • 2016-04-30
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 2021-06-11
      • 2022-08-08
      • 2016-06-02
      相关资源
      最近更新 更多