Fix markdown rendering, add inline button menus, and fix duplicate cancel message on /followup redirect#2
Draft
Fix markdown rendering, add inline button menus, and fix duplicate cancel message on /followup redirect#2
Conversation
…mprovements Co-authored-by: HugoWong528 <267603037+HugoWong528@users.noreply.github.com> Agent-Logs-Url: https://github.com/HugoWong528/Telegram-bot/sessions/076ab1bd-869d-4c65-ada5-a9819f317a95
Copilot created this pull request from a session on behalf of
HugoWong528
March 25, 2026 05:45
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent issues: markdown was never rendered in AI responses (missing
parse_modeeverywhere), no interactive menus existed for model selection or navigation, and/followupredirecting an active stream caused both the original handler and/followupto each send a cancellation message.Markdown rendering
_is_parse_error(exc: BadRequest) -> boolhelper — single source of truth for detecting Telegram entity-parse failures, used consistently across all three fallback sites._safe_edit_textand_send_chunksnow acceptparse_mode; on a parse error they retry with plain text so the message is always delivered.ParseMode.MARKDOWN:_stream_to_messagefinal edit,_send()closures incompany_command/build_command/autorun_command, andabout_command,weather_command,company_roles_command,_do_build_followup,_weather_reminder_job.Inline button menus
/start: New welcome command with an 8-button inline keyboard covering all major commands (replacesabout_commandmapping)./settings(no args): Shows a model-selection inline keyboard instead of plain text — vision indicator (✅/📝), ★ on current selection, "Clear preference" button.model_select_callbackhandlesset_model:<name>/set_model:clearpresses.cmd_shortcut_callbackhandlescmd:<name>presses from/start— shows a usage hint or the settings keyboard inline.Interrupt fix + streaming responsiveness
_silenced_cancels: set[int];/followupadds the user ID before callingtask.cancel()so the original handler'sCancelledErrorcatch suppresses the duplicate "⛔ cancelled" message:STREAM_EDIT_INTERVALreduced 2.0 s → 1.0 s for faster live streaming updates.