From 2a1f5e11f832f33e3212b6f91a8906981b974e42 Mon Sep 17 00:00:00 2001 From: NanamiAdmin Date: Wed, 2 Sep 2026 21:35:07 +0800 Subject: [PATCH] feat(controller): update notification logic to respect event_status_notify settings for trusted groups and admins --- internal/controller/pipes/qq_napcat/qq.go | 22 ++++++++++++------- .../controller/pipes/telegram/telegram.go | 16 +++++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/internal/controller/pipes/qq_napcat/qq.go b/internal/controller/pipes/qq_napcat/qq.go index 1afad22..2b9b299 100644 --- a/internal/controller/pipes/qq_napcat/qq.go +++ b/internal/controller/pipes/qq_napcat/qq.go @@ -247,14 +247,20 @@ func (q *QQController) SendStatusChange(change node.StatusChange) error { params := template.BuildParamsFromStatusChange(change) message := template.Render(cfg.ControllerMessage.ServerStatusChanged, params) - // Send to trusted groups. - for _, groupID := range q.trustedGroupIDs() { - q.sendGroupMessage(groupID, message) - } - - // Send to admins via private message. - for _, adminID := range q.adminIDs() { - q.sendPrivateMessage(adminID, message) + // Only notify trusted groups and admins whose event_status_notify is true. + if uc := config.C_botUserConfig; uc != nil { + for groupID, opts := range uc.QQ.TrustedGroups { + if !opts.EventStatusNotify { + continue + } + q.sendGroupMessage(groupID, message) + } + for adminID, opts := range uc.QQ.Admins { + if !opts.EventStatusNotify { + continue + } + q.sendPrivateMessage(adminID, message) + } } return nil diff --git a/internal/controller/pipes/telegram/telegram.go b/internal/controller/pipes/telegram/telegram.go index 6ab9bd0..0aba9ef 100644 --- a/internal/controller/pipes/telegram/telegram.go +++ b/internal/controller/pipes/telegram/telegram.go @@ -249,7 +249,21 @@ func (t *TelegramController) SendStatusChange(change node.StatusChange) error { params := template.BuildParamsFromStatusChange(change) message := template.Render(cfg.ControllerMessage.ServerStatusChanged, params) - t.sendToGroupsAndAdmins(message) + // Only notify trusted groups and admins whose event_status_notify is true. + if uc := config.C_botUserConfig; uc != nil { + for groupID, opts := range uc.Telegram.TrustedGroups { + if !opts.EventStatusNotify { + continue + } + t.sendGroupMessage(groupID, message) + } + for admin, opts := range uc.Telegram.Admins { + if !opts.EventStatusNotify { + continue + } + t.sendAdminMessage(admin, message) + } + } return nil }