note

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MinSetGroupNoteLevel = 5

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstantEverySchedule

type ConstantEverySchedule struct {
	StartAt time.Time
	Delay   time.Duration
}

ConstantEverySchedule 重复性间隔时间执行,StartAt代表开始时间点

func (ConstantEverySchedule) Next

func (schedule ConstantEverySchedule) Next(t time.Time) time.Time

type RemindTask

type RemindTask struct {
	ID      int64
	UserID  int64 // 提醒的设置人ID
	GroupID int64 // 非0即为群推送
	Content string
	// 根据用户设定生成,一次性写入
	IsOnce bool      // 是否为一次性任务
	Spec   string    // 重复性任务专用:代表CRON表达式
	RunAt  time.Time // 一次性任务专用:执行时间点
	// 程序维护
	CronID    int // 唯一的每次重启bot都需重写的字段
	CreatedAt time.Time
}

func (RemindTask) Job

func (task RemindTask) Job() func()

Job 生成 到达定时点时所要执行的 任务函数

func (*RemindTask) ParseCNTime

func (task *RemindTask) ParseCNTime(str string) (err error)

ParseCNTime 解析中文时间表达str,填充IsOnce\Spec\RunAt

func (*RemindTask) ParseSpecTime

func (task *RemindTask) ParseSpecTime(spec string, isOnce bool) error

ParseSpecTime 解析CRON时间表达式spec,填充IsOnce\Spec\RunAt

func (RemindTask) String

func (task RemindTask) String() string

type StickTimeSchedule

type StickTimeSchedule struct {
	At time.Time
}

StickTimeSchedule 固定单一时间点执行

func (StickTimeSchedule) Next

func (schedule StickTimeSchedule) Next(t time.Time) time.Time

Jump to

Keyboard shortcuts

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