0

我在用:

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

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

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

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

4

1 回答 1

0

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

{
    "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-01-20T20:48:04.773 回答