mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6999] [MERGED] fix(tgbot): send fresh screens for typed commands #6570
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6570
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6999
Author: @HamedSanaei
Created: 10/28/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @MHSanaei
Base:
main← Head:codex/fix-telegram-command-screens📝 Commits (3)
35bc7dbfix(tgbot): send fresh screens for typed commands411a16ffix(tgbot): retire keyboards when old menus cannot be deletedc08b8bfMerge remote-tracking branch 'origin/main' into pr/6999📊 Changes
9 files changed (+207 additions, -77 deletions)
View changed files
➕
internal/web/service/tgbot/command_screen_test.go(+142 -0)📝
internal/web/service/tgbot/screen.go(+27 -14)📝
internal/web/service/tgbot/screen_legacy.go(+2 -2)📝
internal/web/service/tgbot/screen_views.go(+7 -7)📝
internal/web/service/tgbot/screens_test.go(+8 -39)📝
internal/web/service/tgbot/tgbot_client.go(+3 -3)📝
internal/web/service/tgbot/tgbot_reports_usage_test.go(+4 -4)📝
internal/web/service/tgbot/tgbot_router.go(+7 -7)📝
internal/web/service/tgbot/tgbot_send.go(+7 -1)📄 Description
Summary
Send a fresh screen for typed Telegram commands instead of editing the remembered menu message. Keep callback navigation on the existing edit-first path. After a successful replacement, delete the old menu or remove its keyboard if deletion fails.
Why
Closes #6997.
The command handler draws a screen and then removes the incoming command. Previously, every screen render first tried to edit the remembered message ID. A successful edit therefore did not guarantee a newly visible response when the user returned after clearing chat history.
Commands now explicitly request a new message through the shared renderer. The delivery choice is an argument passed through the existing views, not mutable bot-wide or chat-wide mode state. This covers admin/client
/start, admin/status, admin/client/usage, and admin/clearall; callbacks retain their normal edit behavior. Notices, authorization, client ownership checks, menu content, artwork and active-menu keyboards are unchanged.Telegram restricts message deletion to messages less than 48 hours old. If deletion fails after the new screen is sent, retire the previous menu's buttons through the existing reply-markup edit helper, with a bounded timeout. Cleanup is best effort: even if both cleanup calls fail, keep the newly sent screen tracked. Never delete or strip the previous menu when sending its replacement fails.
Related: #6968 addresses rejected cached artwork. This PR addresses command delivery even when editing the old message succeeds; it does not include the artwork-recovery changes.
Type of change
Areas affected
How was this tested?
The new regressions use real temporary database records and an
httptestTelegram API server that accepts edits of the remembered message./startis repeated to cover another cleared-history/re-entry cycle./startto edit the existing message is replaced by these stronger command regressions. Existing initial-start and default edit-first renderer tests remain.Validation:
go vet -p=2 ./...: passed.make verify: passed, including all Go tests/build, lint/typecheck/format, 2,018 frontend tests, production and Storybook builds, generation checks and published OpenAPI consistency.make race: passed across Go packages.411a16f6, including race, fuzz smoke, both PostgreSQL suites and node end-to-end tests. The initial automated review covered35bc7dba; its one LOW is addressed in the follow-up, with no automatic re-review on synchronization.Manual reproduction:
/startto establish a menu.No live Telegram account or bot was contacted. The tests model the successful-old-edit condition; Telegram clients' history-deletion visibility was not validated directly.
Breaking changes
None. No API route, database schema, setting, translation, dependency, panel UI or Xray runtime changes. Typed screen-producing commands intentionally get a new message ID; the previous menu is retired only after the new send succeeds.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass. No frontend changes; these checks still ran.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #6999] fix(tgbot): send fresh screens for typed commandsto [PR #6999] [MERGED] fix(tgbot): send fresh screens for typed commands