【问题标题】:How to send '#' to chat with Telegram bot API?如何发送“#”与 Telegram bot API 聊天?
【发布时间】:2021-04-01 06:10:43
【问题描述】:

我正在尝试使用带有此 URL 的 Telegram API 发送文本,例如“Hello # World”:

https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+#+World

但我只收到Hello

我也试过这样编码:

https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+%23+World

但我只收到Hello %23 World

有没有办法接收Hello # World?谢谢:D

【问题讨论】:

    标签: telegram telegram-bot telegram-api


    【解决方案1】:

    你没有正确url-encode字符串,应该是

    Hello%20%23%20World
    

    改为关闭

    Hello+%23+World
    

    完整的网址:

    https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT-ID>&text=Hello%20%23%20World
    

    【讨论】:

      猜你喜欢
      • 2017-10-03
      • 2022-12-21
      • 2022-01-24
      • 1970-01-01
      • 1970-01-01
      • 2019-10-01
      • 2020-04-14
      • 2015-09-20
      • 1970-01-01
      相关资源
      最近更新 更多