Skip to content

Bot API 10.3, MessageGenerationStopped contains the bot's own chat instead of the target private chat #891

Description

@Meosit

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

  1. Enable forum/topic mode for a bot.

  2. 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
    }
  3. Stream a rich-message draft to <USER_ID> in that topic with can_stop=true.

  4. Press Telegram's native “Stop generation” button.

  5. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions