notify

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notify sends best-effort direct messages for early runtime phases before the durable outbox exists.

Index

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 New

func New(users *store.Users, sender messageSender, logger *slog.Logger) *Notifier

New returns a best-effort notifier.

func NewDurable

func NewDurable(users *store.Users, outbox outboxEnqueuer, logger *slog.Logger) *Notifier

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) SendDM

func (n *Notifier) SendDM(ctx context.Context, tgID int64, text string) error

SendDM sends a direct message unless the user is known as blocked.

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

func (n *Notifier) SendFormattedDM(ctx context.Context, tgID int64, text string) error

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

func (n *Notifier) SendFormattedOwners(
	ctx context.Context, ownerIDs []int64, text string,
) error

SendFormattedOwners sends the same formatted direct message to every owner.

func (*Notifier) SendOwners

func (n *Notifier) SendOwners(
	ctx context.Context, ownerIDs []int64, text string,
) error

SendOwners sends the same direct message to every owner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL