In Bot API 10.3, stopped_message_generation.chat does not match the documented MessageGenerationStopped contract when a user stops generation in a private bot forum topic.
The update contains the bot's own identity instead of the private chat/user to which the draft was sent.
This prevents applications from locating the corresponding active response through the documented chat identity. A bot may consequently ignore the stop request and continue generating and later send the final response.
Documentation: https://core.telegram.org/bots/api#messagegenerationstopped
Bot API version
Bot API 10.3
Bot API source:
|
class Client::JsonMessageGenerationStopped final : public td::Jsonable { |
|
public: |
|
JsonMessageGenerationStopped(const td_api::updateStopMessageDraft *update_stop_message_draft, const Client *client) |
|
: update_stop_message_draft_(update_stop_message_draft), client_(client) { |
|
} |
|
void store(td::JsonValueScope *scope) const { |
|
auto object = scope->enter_object(); |
|
object("chat", JsonChat(update_stop_message_draft_->chat_id_, client_)); |
|
if (update_stop_message_draft_->forum_topic_id_ != 0) { |
|
object("message_thread_id", update_stop_message_draft_->forum_topic_id_); |
|
} |
|
object("draft_id", td::to_string(update_stop_message_draft_->draft_id_)); |
|
} |
Steps to reproduce
-
Enable forum/topic mode for a bot.
-
Receive a message from a user in a private chat topic.
{
"chat": {
"id": "<USER_ID>",
"type": "private"
},
"from": {
"id": "<USER_ID>"
},
"message_thread_id": 1605752
}
-
Stream a rich-message draft to <USER_ID> in that topic with can_stop=true.
-
Press Telegram's native “Stop generation” button.
-
Inspect the resulting stopped_message_generation update.
Actual result
The update contains the bot's own private-chat identity:
{
"stopped_message_generation": {
"chat": {
"id": "<BOT_ID>",
"first_name": "<BOT_NAME>",
"username": "<BOT_USERNAME>",
"type": "private"
},
"message_thread_id": 1605752
}
}
The value of stopped_message_generation.chat.id equals getMe().id, not the chat_id supplied when sending the draft.
In Bot API 10.3,
stopped_message_generation.chatdoes not match the documentedMessageGenerationStoppedcontract when a user stops generation in a private bot forum topic.The update contains the bot's own identity instead of the private chat/user to which the draft was sent.
This prevents applications from locating the corresponding active response through the documented chat identity. A bot may consequently ignore the stop request and continue generating and later send the final response.
Documentation: https://core.telegram.org/bots/api#messagegenerationstopped
Bot API version
Bot API 10.3
Bot API source:
telegram-bot-api/telegram-bot-api/Client.cpp
Lines 3980 to 3992 in 2efabc7
Steps to reproduce
Enable forum/topic mode for a bot.
Receive a message from a user in a private chat topic.
{ "chat": { "id": "<USER_ID>", "type": "private" }, "from": { "id": "<USER_ID>" }, "message_thread_id": 1605752 }Stream a rich-message draft to
<USER_ID>in that topic withcan_stop=true.Press Telegram's native “Stop generation” button.
Inspect the resulting
stopped_message_generationupdate.Actual result
The update contains the bot's own private-chat identity:
{ "stopped_message_generation": { "chat": { "id": "<BOT_ID>", "first_name": "<BOT_NAME>", "username": "<BOT_USERNAME>", "type": "private" }, "message_thread_id": 1605752 } }The value of
stopped_message_generation.chat.idequalsgetMe().id, not thechat_idsupplied when sending the draft.