···5656 BlobTakedowns []string
5757 // If "true", indicates that a rule indicates that the action causing the event should be blocked or prevented
5858 RejectEvent bool
5959+ // Services, if any, which should blast out a notification about this even (eg, Slack)
6060+ NotifyServices []string
5961}
60626163// Enqueues the named counter to be incremented at the end of all rule processing. Will automatically increment for all time periods.
···183185 }
184186 }
185187 e.BlobTakedowns = append(e.BlobTakedowns, cid)
188188+}
189189+190190+// Records that the given service should be notified about this event
191191+func (e *Effects) Notify(srv string) {
192192+ e.mu.Lock()
193193+ defer e.mu.Unlock()
194194+ for _, v := range e.NotifyServices {
195195+ if v == srv {
196196+ return
197197+ }
198198+ }
199199+ e.NotifyServices = append(e.NotifyServices, srv)
186200}
187201188202func (e *Effects) Reject() {
+13-10
automod/engine/engine.go
···2626//
2727// NOTE: careful when initializing: several fields must not be nil or zero, even though they are pointer type.
2828type Engine struct {
2929- Logger *slog.Logger
3030- Directory identity.Directory
3131- Rules RuleSet
3232- Counters countstore.CountStore
3333- Sets setstore.SetStore
3434- Cache cachestore.CacheStore
3535- Flags flagstore.FlagStore
2929+ Logger *slog.Logger
3030+ Directory identity.Directory
3131+ Rules RuleSet
3232+ Counters countstore.CountStore
3333+ Sets setstore.SetStore
3434+ Cache cachestore.CacheStore
3535+ Flags flagstore.FlagStore
3636+ // unlike the other sub-modules, this field (Notifier) may be nil
3737+ Notifier Notifier
3838+ // TODO: unused; remove?
3639 RelayClient *xrpc.Client
3737- BskyClient *xrpc.Client
4040+ // use to fetch public account metadata from AppView
4141+ BskyClient *xrpc.Client
3842 // used to persist moderation actions in mod service (optional)
3939- AdminClient *xrpc.Client
4040- SlackWebhookURL string
4343+ AdminClient *xrpc.Client
4144}
42454346// Entrypoint for external code pushing arbitrary identity events in to the engine.
+11
automod/engine/notifier.go
···11+package engine
22+33+import (
44+ "context"
55+)
66+77+// Interface for a type that can handle sending notifications
88+type Notifier interface {
99+ SendAccount(ctx context.Context, service string, c *AccountContext) error
1010+ SendRecord(ctx context.Context, service string, c *RecordContext) error
1111+}