heartbeat

package
v0.0.0-...-71a3f77 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJobNotFound = errors.New("no such job is registered")

Functions

This section is empty.

Types

type ActionProvider

type ActionProvider interface {
	Init(*types.Config, *discord.Session, storage.Storer, *forum.ForumClient) (string, error)
	Register() []common.Action
}

ActionProvider describes a type that provides a registration function that provides a set of actions that have some random chance to be called on a schedule. The `chance` parameter controls the probability the `call` function is called each time a cron job specified by `schedule` occurs.

type Heartbeat

type Heartbeat struct {
	Config  *types.Config
	Discord *discord.Session
	Storage storage.Storer
	Forum   *forum.ForumClient

	Readme *readme.Readme
	// contains filtered or unexported fields
}

Heartbeat controls a set of plugins that do stuff periodically.

func (*Heartbeat) Init

func (a *Heartbeat) Init(
	config *types.Config,
	discord *discord.Session,
	api storage.Storer,
	fc *forum.ForumClient,
) (err error)

func (*Heartbeat) OnMessage

func (a *Heartbeat) OnMessage(discordgo.Message) (err error)

func (*Heartbeat) RunJob

func (a *Heartbeat) RunJob(name string) error

func (*Heartbeat) Statuses

func (a *Heartbeat) Statuses() []JobStatus

type JobStatus

type JobStatus struct {
	Name      string     `json:"name"`
	Provider  string     `json:"provider"`
	Schedule  string     `json:"schedule"`
	LastRun   *time.Time `json:"lastRun,omitempty"`
	LastError string     `json:"lastError,omitempty"`
	RunCount  int        `json:"runCount"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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