reminderdaemon

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	Database  Database
	Messenger asyncmessenger.Messenger
}

Daemon holds all information for the reminder daemon

func Create

func Create(db Database, messenger asyncmessenger.Messenger) *Daemon

Create creates a new reminder daemon

func (*Daemon) CheckForDailyReminder

func (d *Daemon) CheckForDailyReminder() error

CheckForDailyReminder checks which daily reminder messages needs to be send out and sends them.

func (*Daemon) Start

func (d *Daemon) Start(wg *sync.WaitGroup) error

Start starts the daemon

type Database

type Database interface {
	// Message
	AddMessage(message *database.Message) (*database.Message, error)
	GetLastMessageByType(msgType database.MessageType, channel *database.Channel) (*database.Message, error)
	// Reminder
	GetPendingReminder() ([]database.Reminder, error)
	GetMessageFromReminder(reminderID uint, msgType database.MessageType) (*database.Message, error)
	SetReminderDone(*database.Reminder) (*database.Reminder, error)
	GetDailyReminder(channel *database.Channel) (*[]database.Reminder, error)
	// Channel
	GetChannelList() ([]database.Channel, error)
}

Database defines a database interface for the reminderdaemon

type Messenger

type Messenger interface {
	SendReminder(*database.Reminder, *database.Message) (*database.Message, error)
	SendFormattedMessage(msg, msgFormatted string, channel *database.Channel, msgType database.MessageType, relatedReminderID uint) (resp *mautrix.RespSendEvent, err error)
}

Messenger defines a messenger interface for the reminderdaemon

Jump to

Keyboard shortcuts

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