Documentation
¶
Overview ¶
Package notify sends best-effort direct messages for early runtime phases before the durable outbox exists.
Index ¶
- type Notifier
- func (n *Notifier) SendAlertDM(ctx context.Context, tgID int64, alertID int64, text string, parseMode string) error
- func (n *Notifier) SendDM(ctx context.Context, tgID int64, text string) error
- func (n *Notifier) SendDurableDM(ctx context.Context, tgID int64, text string, marker string) error
- func (n *Notifier) SendFormattedAlertOwners(ctx context.Context, ownerIDs []int64, alertID int64, text string) error
- func (n *Notifier) SendFormattedDM(ctx context.Context, tgID int64, text string) error
- func (n *Notifier) SendFormattedDurableDM(ctx context.Context, tgID int64, text string, parseMode string, marker string) error
- func (n *Notifier) SendFormattedOwners(ctx context.Context, ownerIDs []int64, text string) error
- func (n *Notifier) SendOwners(ctx context.Context, ownerIDs []int64, text string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier sends direct messages while respecting users.dm_state.
func NewDurable ¶
NewDurable returns a notifier that enqueues send_dm actions.
func (*Notifier) SendAlertDM ¶ added in v0.2.0
func (n *Notifier) SendAlertDM( ctx context.Context, tgID int64, alertID int64, text string, parseMode string, ) error
SendAlertDM enqueues one direct message linked to alertID, for a caller that already knows the single recipient. Same contract as SendFormattedAlertOwners: the link retires the delivery when the alert resolves, and it is also the message's dedupe identity. An empty parseMode sends plain text.
func (*Notifier) SendDurableDM ¶
func (n *Notifier) SendDurableDM( ctx context.Context, tgID int64, text string, marker string, ) error
SendDurableDM enqueues a direct message when the notifier was constructed with NewDurable; marker participates in idempotency.
func (*Notifier) SendFormattedAlertOwners ¶ added in v0.2.0
func (n *Notifier) SendFormattedAlertOwners( ctx context.Context, ownerIDs []int64, alertID int64, text string, ) error
SendFormattedAlertOwners notifies every owner about alertID and links each enqueued row to it, so resolving the alert cancels whatever has not gone out yet. On the non-durable notifier (startup, no outbox) the message is sent immediately and there is no row to link or cancel — that path keeps its current behaviour.
func (*Notifier) SendFormattedDM ¶
SendFormattedDM sends a formatted direct message unless the user is known as blocked.
func (*Notifier) SendFormattedDurableDM ¶
func (n *Notifier) SendFormattedDurableDM( ctx context.Context, tgID int64, text string, parseMode string, marker string, ) error
SendFormattedDurableDM enqueues or sends a formatted direct message.
func (*Notifier) SendFormattedOwners ¶
SendFormattedOwners sends the same formatted direct message to every owner.