mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6385] [Feature]: Add feature Discord Bot #4331
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#4331
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?
Originally created by @omarsenusi on GitHub (Sep 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6385
Is your feature request related to a problem?
Currently, the panel only supports Telegram notifications/bot settings. It would be helpful to have Discord bot support as well, as many communities and admins rely on Discord for notifications, alerts, and management.
Describe the solution you'd like
Add a new configuration section in the panel settings for Discord Bot:
Enable/Disable Discord Bot: Toggle switch.
Bot Token: Input field for the Discord bot token.
Admin/Channel ID: Input field for sending system alerts and client notifications directly to a specified Discord channel or admin user.
Commands Support: Basic commands similar to the Telegram bot (e.g., status, traffic usage, client status).
Alternatives you've considered
Using third-party webhooks or external custom scripts, but having built-in integration directly within the panel GUI would be much cleaner and more convenient for administrators.
Concrete use case
I manage a server community on Discord and prefer receiving system logs, bandwidth alerts, and server notifications directly in our admin Discord channels instead of using Telegram.
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
No response
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Sep 1, 2026):
Thanks — this is a valid feature request, not a bug: there is genuinely no Discord support anywhere in the panel today. A case-insensitive search for
discordacross the whole tree returns no matches, and the only two built-in notification channels are the Telegram bot (internal/web/service/tgbot/) and SMTP email (internal/web/service/email/). Leaving this open for a maintainer to decide on; I can't accept or schedule features.One correction to the "I searched existing issues" box: the same request already exists as #2751 ("Discord Bot", opened 2025-03-10, labelled
enhancement, closed 2025-03-11). Yours is far more specific, so I'm not closing this as a duplicate — but the earlier decision on #2751 is the relevant precedent, and I could not determine its close reason.Since you offered to implement it
The good news is that the notification half already has a designed extension point.
internal/eventbus/is an in-process pub/sub, anddocs/architecture.md§5.7 says outright:The event types a Discord notifier would consume are fixed in
internal/eventbus/events.go:10-25—outbound.down|up,xray.crash,node.down|up,cpu.high,memory.high,login.attempt.The email notifier is the smallest template to copy —
internal/web/service/email/subscriber.gois 198 lines, and its whole contract is one method (line 33):and it is wired in
internal/web/web.go:632-633:A
"discord-notifier"would sit next to that and next to the"tg-notifier"subscriptions atinternal/web/web.go:668and:680.The settings you described map onto the existing pattern in
internal/web/service/setting.go— the defaults map already holds"tgBotEnable": "false"(line 74),"smtpEnable": "false"(line 168) and"smtpEnabledEvents": "login.attempt,cpu.high"(line 160), each with a getter/setter pair further down. On the UI side,frontend/src/pages/settings/TelegramTab.tsxandEmailTab.tsxare the shape aDiscordTab.tsxwould follow.Scope warning — the two halves are not the same size
Your request bundles two things with very different costs:
tgbot_router.goalone is 1,492;tgbot_client.go782;tgbot.go537). It also pulls a dependency:github.com/mymmrac/telego(tgbot.go:25). A Discord equivalent means a comparable library plus a second implementation of every command surface.If you do open a PR, splitting it — notify-only first, commands later — is much more likely to be reviewable.
CLAUDE.mdalso states a hard rule worth reading before you start: "Fix size must match bug size… If a fix genuinely needs new architecture, say so and get agreement first." Getting agreement on the approach before writing 4,000 lines is the point.Four repo rules that will fail CI if missed:
g.POST/g.GETininternal/web/controller/needs a matching entry infrontend/src/pages/api-docs/endpoints.ts— pinned both ways byTestRouteRegistryContractininternal/web/routes_contract_test.go.StructAllowintools/openapigen/main.go, or it is silently dropped from the schemas andbuild-openapi.mjsthen fails.internal/web/translation/and must be referenced in the same commit —frontend/src/test/i18n-dead-keys.test.tsfails both ways.make verifylocally; it is the gate that mirrors most of CI.Until something lands, the closest built-in option is enabling SMTP email alerts, which already fire on the same event set via
smtpEnabledEvents.Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.