[GH-ISSUE #5318] [Feature]: Show inbound remark alongside username for online clients in Telegram bot #3726

Closed
opened 2026-10-31 20:34:30 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @xingshuwen03-prog on GitHub (Jun 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5318

I am always frustrated when checking 'Online Clients' via the Telegram bot, as it only displays the client's username. Since I have set up multiple inbounds for different servers (e.g., 'USA' and 'Japan'), I cannot determine which specific inbound a user is currently connected to just by looking at the TG bot. This forces me to manually log into the web panel to check their connection details, completely defeating the convenience of using the bot.

Describe the solution you'd like

I am always frustrated when checking 'Online CliI would like the Telegram bot to dynamically append the "Inbound Remark" to the client's username when displaying the "Online Clients" list.

TelegramBot UI / Output Format: The display format should change from {username} to {username} - {inbound_remark}. For example, if a client user connects via an inbound with the remark USA, it should display user - USA.

Backend / API Structure: The backend service (specifically within internal/web/service/tgbot/ and the Xray stats service) needs to fetch and map the inbound remark name to the active client's connection data before sending the message payload to the Telegram bot.

Configuration Keys: This feature could be enabled by default, or a new toggle could be added to the Panel Settings (e.g., a boolean key like tgBotShowInboundRemark: true).

Alternatives you've considered

I currently have to log into the web panel manually to check the "Inbounds" or "Clients" page to see the specific connection path. While this works as a temporary workaround, it falls short because it completely defeats the purpose of having a Telegram bot for quick, on-the-go monitoring. It adds unnecessary steps and friction to a task that should be instantly accessible via the bot.

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Telegram bot

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @xingshuwen03-prog on GitHub (Jun 14, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5318 ### Is your feature request related to a problem? I am always frustrated when checking 'Online Clients' via the Telegram bot, as it only displays the client's username. Since I have set up multiple inbounds for different servers (e.g., 'USA' and 'Japan'), I cannot determine which specific inbound a user is currently connected to just by looking at the TG bot. This forces me to manually log into the web panel to check their connection details, completely defeating the convenience of using the bot. ### Describe the solution you'd like I am always frustrated when checking 'Online CliI would like the Telegram bot to dynamically append the "Inbound Remark" to the client's username when displaying the "Online Clients" list. TelegramBot UI / Output Format: The display format should change from {username} to {username} - {inbound_remark}. For example, if a client user connects via an inbound with the remark USA, it should display user - USA. Backend / API Structure: The backend service (specifically within internal/web/service/tgbot/ and the Xray stats service) needs to fetch and map the inbound remark name to the active client's connection data before sending the message payload to the Telegram bot. Configuration Keys: This feature could be enabled by default, or a new toggle could be added to the Panel Settings (e.g., a boolean key like tgBotShowInboundRemark: true). ### Alternatives you've considered I currently have to log into the web panel manually to check the "Inbounds" or "Clients" page to see the specific connection path. While this works as a temporary workaround, it falls short because it completely defeats the purpose of having a Telegram bot for quick, on-the-go monitoring. It adds unnecessary steps and friction to a task that should be instantly accessible via the bot. ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Telegram bot ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:34:30 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 14, 2026):

The request is valid and the architecture supports it. Here is a precise description of what would need to change.

Current behavior (confirmed in source)

onlineClients() in internal/web/service/tgbot/tgbot_report.go (line 363) calls service.XrayProcess().GetOnlineClients(), which returns a flat []string of client email addresses with no inbound metadata. Each entry is displayed as-is as an inline keyboard button label (line 377). The inbound remark is not part of this data path at all.

Why the data is available

The InboundService already exposes GetClientInboundByEmail(email string) (*xray.ClientTraffic, *model.Inbound, error) (confirmed in internal/web/service/inbound_clients.go, line 385). The returned *model.Inbound has a Remark field. The tgbot already uses this field in other views (for example, tgbot_report.go:246 and tgbot_inbound.go:28 both render inbound.Remark), and t.inboundService is already available inside the tgbot struct where onlineClients() is defined.

One complication to be aware of

A client email can be attached to more than one inbound. GetClientInboundByEmail returns only the first traffic row found (line 368: traffic = traffics[0]). In a multi-inbound setup the remark appended to the label would reflect whichever inbound the DB returns first, not necessarily the one the client is currently connected through. An implementation that wants to be accurate about the active inbound would need a different data source; however for the common single-inbound-per-client case the simpler approach would work.

Scope of the change

The minimal change required is:

  • In onlineClients() (internal/web/service/tgbot/tgbot_report.go), for each online email string, call GetClientInboundByEmail and append inbound.Remark to the button label, while keeping online as the callback data so the existing client_get_usage routing still works.
  • No new setting key or toggle is strictly necessary for an MVP; a config toggle could be added later if desired.

No changes to internal/xray/process.go or the gRPC stats layer are needed.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4701867837 --> @github-actions[bot] commented on GitHub (Jun 14, 2026): The request is valid and the architecture supports it. Here is a precise description of what would need to change. **Current behavior (confirmed in source)** `onlineClients()` in `internal/web/service/tgbot/tgbot_report.go` (line 363) calls `service.XrayProcess().GetOnlineClients()`, which returns a flat `[]string` of client email addresses with no inbound metadata. Each entry is displayed as-is as an inline keyboard button label (line 377). The inbound remark is not part of this data path at all. **Why the data is available** The `InboundService` already exposes `GetClientInboundByEmail(email string) (*xray.ClientTraffic, *model.Inbound, error)` (confirmed in `internal/web/service/inbound_clients.go`, line 385). The returned `*model.Inbound` has a `Remark` field. The tgbot already uses this field in other views (for example, `tgbot_report.go:246` and `tgbot_inbound.go:28` both render `inbound.Remark`), and `t.inboundService` is already available inside the tgbot struct where `onlineClients()` is defined. **One complication to be aware of** A client email can be attached to more than one inbound. `GetClientInboundByEmail` returns only the first traffic row found (line 368: `traffic = traffics[0]`). In a multi-inbound setup the remark appended to the label would reflect whichever inbound the DB returns first, not necessarily the one the client is currently connected through. An implementation that wants to be accurate about the active inbound would need a different data source; however for the common single-inbound-per-client case the simpler approach would work. **Scope of the change** The minimal change required is: - In `onlineClients()` (`internal/web/service/tgbot/tgbot_report.go`), for each `online` email string, call `GetClientInboundByEmail` and append `inbound.Remark` to the button label, while keeping `online` as the callback data so the existing `client_get_usage` routing still works. - No new setting key or toggle is strictly necessary for an MVP; a config toggle could be added later if desired. No changes to `internal/xray/process.go` or the gRPC stats layer are needed. *This reply was generated automatically; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3726
No description provided.