Skip to content

Bot commands tapped in a bot's "New Chat" tab don't switch into the created topic, and "Continue Last Thread" opens an empty topic #2313

Description

@designcodeandrobots

Setup: a bot with direct-messages topics enabled (Bot API 9.3, has_topics_enabled), iOS client, the "New Chat" tab of the bot chat.

Steps to reproduce:

  1. Open the bot's New Chat tab.
  2. Tap a slash command from the suggestion list / command menu (do not type it manually).

Expected: same behavior as a typed message — the client creates the topic and switches the user into it before sending.

Actual: the user stays in the New Chat tab. The topic is created server-side (the bot receives forum_topic_created with the command as the implicit name and a message_thread_id), but the client does not enter it. The client-synthesized "Continue Last Thread" button under the sent command opens that topic empty until the bot's reply lands there, which reads as a broken button.

Where the paths diverge in the code:

  • A typed message from the root of a user-managed bot forum goes through the new-topic redirect in submodules/TelegramUI/Sources/ChatControllerNode.swift: targetThreadId = EngineMessage.newTopicThreadId + updateChatLocationThread(...) before sending — so the UI switches into the topic.
  • A tapped command goes through the sendBotCommand interaction in submodules/TelegramUI/Sources/ChatController.swift, which sends with threadId: chatLocation.threadId (nil at the root) and contains none of the new-topic/navigation logic.
  • "Continue Last Thread" (ChatHistoryEntriesForView.swiftChatMessageBubbleItemNode.swift) decorates the last message with a threadId and its tap handler only opens that thread locally, so it lands on an empty view.

Suggestion: route tapped bot commands in a topics-enabled bot chat through the same new-topic path as typed messages (redirect into newTopicThreadId and switch the chat location), so the user follows the command into its topic.

Nothing on the Bot API side can compensate: there is no method to navigate the client or pre-render the topic; a bot can only reply into the received message_thread_id as fast as possible.

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