我正在使用:
https://api.telegram.org/[bot_id]/getUpdates
检索最近的更新。它返回一个消息对象,但它不包含消息的“text”字段。
"message": {
"message_id": 5,
"from": {
"id": 26002823,
"first_name": "Johnny",
"last_name": "Appleseed",
"username": "username"
},
为什么它没有返回“text”值,所以我可以看到消息说的是什么?
答案 0 :(得分: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
}
}
}]
}