notifications

package
v0.0.0-...-740805f Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListenCoolDown       = 30 * time.Second
	DefaultSendCoolDown         = 500 * time.Millisecond
	DefaultNotificationDeadline = 24 * time.Hour
	// Requires <userName>, <authorName> and <communityName>
	// Mentions <userName>
	DefaultPermissionMessage = `` /* 234-byte string literal not displayed */

	// Requires <userName>, <authorName>, <communityName>, <botUserName> and <authorName>
	// Mentions <userName> and <botUserName>
	DefaultNotificationMessage = `` /* 148-byte string literal not displayed */

	// Requires <userName>, <authorName>, <communityName>, <customText>, <botUserName> and <authorName>
	// Mentions <userName> and <botUserName>
	DefaultCustomNotificationMessage = `` /* 151-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type NotificationManager

type NotificationManager struct {
	// contains filtered or unexported fields
}

NotificationManager is a manager that listens for new notifications registered in the database and sends them to the users via the farcaster API.

func New

New creates a new NotificationManager instance with the given context, database and farcaster API. It also sets the listen cool down duration.

func (*NotificationManager) Start

func (nm *NotificationManager) Start()

Start starts the notification manager and listens for new notifications in the database to send them to the users. It uses a cool down duration to avoid spamming the farcaster API. It runs in the background and send notifications in parallel.

func (*NotificationManager) Stop

func (nm *NotificationManager) Stop()

Stop stops the notification manager and cancels the context.

type NotifificationManagerConfig

type NotifificationManagerConfig struct {
	DB                        *mongo.MongoStorage
	API                       farcasterapi.API
	ListenCoolDown            time.Duration
	DefaultSendCoolDown       time.Duration
	NotificationDeadline      time.Duration
	PermissionMessage         string
	NotificationMessage       string
	CustomNotificationMessage string
	FrameURL                  string
}

Jump to

Keyboard shortcuts

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