nschedule

package
v0.0.0-...-2935971 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = &localConfig{}

Config is the config that contains global config stuff, i mean it is named config so what else would it be

View Source
var Module = &module.Module{
	Name: "nschedule",
	DgoHandlers: []interface{}{
		onReady,
	},

	DebugCommands: []*drc.Command{
		cSendlater,
		cDeletelater,
	},

	Config: Config,

	InitFunc: func(mod *module.Module) error {
		Scheduler.Log = new(logger)
		insched.Debug = Config.Debug

		return nil
	},
	OpenFunc: func(m *module.Module) error {
		db.ss = enpsql.GetSession()

		return nil
	},
	CloseFunc: func(_ *module.Module) {
		Scheduler.Stop()
	},
}

Module contains the module, i mean what else would it contain

View Source
var Scheduler = insched.New(db)

Functions

func DeferSendMessage

func DeferSendMessage(when time.Time, data SendLaterMeta) (uint64, error)

DeferSendMessage schedules a message to be sent at a later time currently only debug, don't use

func MsgDelete

func MsgDelete(at time.Time, meta MetaMsgDelete) (uint64, error)

func RegisterHandler

func RegisterHandler(name string, h insched.Handler)

RegisterHandler adds a handler to the global scheduler

Types

type Database

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

func (*Database) Add

func (db *Database) Add(e insched.Entry) (insched.Entry, error)

func (*Database) Defer

func (db *Database) Defer(id uint64, by time.Duration) (err error)

func (*Database) Get

func (db *Database) Get(id uint64) (e insched.Entry, err error)

func (*Database) GetPending

func (db *Database) GetPending(action string, t time.Time) (el []insched.Entry, err error)

func (*Database) Remove

func (db *Database) Remove(id uint64) (err error)

func (*Database) Reschedule

func (db *Database) Reschedule(id uint64, to time.Time) (err error)

type MetaMsgDelete

type MetaMsgDelete struct {
	ChannelID string
	MessageID string
}

type SendLaterMeta

type SendLaterMeta struct {
	Channel  string
	Contents string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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