【问题标题】:message text not returned in getUpdates telegram botgetUpdates 电报机器人中未返回消息文本
【发布时间】:2017-01-20 06:34:32
【问题描述】:

我正在使用:

https://api.telegram.org/[bot_id]/getUpdates

检索最近的更新。它返回一个消息对象,但是它不包括消息的“文本”字段。

"message": {
        "message_id": 5,
        "from": {
          "id": 26002823,
          "first_name": "Johnny",
          "last_name": "Appleseed",
          "username": "username"
        },

为什么它不返回“文本”值以便我可以看到消息内容?

【问题讨论】:

    标签: api telegram telegram-bot python-telegram-bot php-telegram-bot


    【解决方案1】:

    这里是电报不同的对象,可能是贴纸或文档文件。

    {
        "ok": true,
        "result": [{
            "update_id": 513400512,
            "message": {
                "message_id": 3,
                "from": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye"
                },
                "chat": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye",
                    "type": "private"
                },
                "date": 1484944898,
                "text": "hi"
            }
        }, {
            "update_id": 513400513,
            "message": {
                "message_id": 4,
                "from": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye"
                },
                "chat": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye",
                    "type": "private"
                },
                "date": 1484944975,
                "sticker": {
                    "width": 512,
                    "height": 512,
                    "emoji": "\ud83d\ude0d",
                    "thumb": {
                        "file_id": "AAQEABMr6HIwAAT9WnLtRCT6KIgiAAIC",
                        "file_size": 2828,
                        "width": 128,
                        "height": 128
                    },
                    "file_id": "BQADBAADrwgAAjn8EwY1EPt_ycp8OwI",
                    "file_size": 14102
                }
            }
        }, {
            "update_id": 513400515,
            "message": {
                "message_id": 6,
                "from": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye"
                },
                "chat": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye",
                    "type": "private"
                },
                "date": 1484944986,
                "text": "\ud83d\ude0d"
            }
        }, {
            "update_id": 513400516,
            "message": {
                "message_id": 7,
                "from": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye"
                },
                "chat": {
                    "id": 86853848,
                    "first_name": "Mojtaba",
                    "last_name": "Yeganeh",
                    "username": "mojtabye",
                    "type": "private"
                },
                "date": 1484945102,
                "document": {
                    "mime_type": "video/mp4",
                    "thumb": {
                        "file_id": "AAQEABN_NmAZAAScKVXd0kYiFiM4AAIC",
                        "file_size": 1681,
                        "width": 67,
                        "height": 90
                    },
                    "file_id": "BQADBAADRwQAAhvmtwXM4rikxEvd7QI",
                    "file_size": 835339
                }
            }
        }]
    } 
    

    【讨论】:

      猜你喜欢
      • 2017-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-10
      • 2018-08-08
      • 2022-10-19
      • 2017-03-19
      相关资源
      最近更新 更多