feat(controller): update notification logic to respect event_status_notify settings for trusted groups and admins

This commit is contained in:
2026-09-02 21:35:07 +08:00
parent 16341972af
commit 2a1f5e11f8
2 changed files with 29 additions and 9 deletions
+14 -8
View File
@@ -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