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

This commit is contained in:
NanamiAdmin committed 2026-09-02 21:35:07 +08:00
1 parent 16341972af
commit 2a1f5e11f8
2 files changed
+29 -9

No files matched your search

+15 -1
View File
@@ -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
}