timer

package
v1.3.3-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: GPL-3.0 Imports: 15 Imported by: 3

Documentation

Overview

Package timer 群管定时器

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock 时钟

func NewClock

func NewClock(db *sql.Sqlite) (c Clock)

NewClock 添加一个新时钟

func (*Clock) AddTimerIntoDB

func (c *Clock) AddTimerIntoDB(t *Timer) (err error)

AddTimerIntoDB 添加定时器

func (*Clock) AddTimerIntoMap

func (c *Clock) AddTimerIntoMap(t *Timer) (err error)

AddTimerIntoMap 添加定时器到缓存

func (*Clock) CancelTimer

func (c *Clock) CancelTimer(key uint32) bool

CancelTimer 取消计时器

func (*Clock) GetTimer

func (c *Clock) GetTimer(key uint32) (t *Timer, ok bool)

GetTimer 获得定时器

func (*Clock) ListTimers

func (c *Clock) ListTimers(grpID int64) []string

ListTimers 列出本群所有计时器

func (*Clock) RegisterTimer

func (c *Clock) RegisterTimer(ts *Timer, save, isinit bool) bool

RegisterTimer 注册计时器

type Timer

type Timer struct {
	ID                          uint32 `db:"id"`
	En1Month4Day5Week3Hour5Min6 int32  `db:"emdwhm"`
	SelfID                      int64  `db:"sid"`
	GrpID                       int64  `db:"gid"`
	Alert                       string `db:"alert"`
	Cron                        string `db:"cron"`
	URL                         string `db:"url"`
}

Timer 计时器

func GetFilledCronTimer

func GetFilledCronTimer(croncmd string, alert string, img string, botqq, gid int64) *Timer

GetFilledCronTimer 获得以cron填充好的ts

func GetFilledTimer

func GetFilledTimer(dateStrs []string, botqq, grp int64, matchDateOnly bool) *Timer

GetFilledTimer 获得填充好的ts

func (*Timer) Day

func (t *Timer) Day() (d int)

Day 5bits

func (*Timer) En

func (t *Timer) En() (en bool)

En isEnabled 1bit

func (*Timer) GetTimerID

func (t *Timer) GetTimerID() uint32

GetTimerID 获得标准化 ID

func (*Timer) GetTimerInfo

func (t *Timer) GetTimerInfo() string

GetTimerInfo 获得标准化定时字符串

func (*Timer) Hour

func (t *Timer) Hour() (h int)

Hour 5bits

func (*Timer) InsertInto

func (t *Timer) InsertInto(db *sql.Sqlite) error

InsertInto 插入自身

func (*Timer) Minute

func (t *Timer) Minute() (min int)

Minute 6bits

func (*Timer) Month

func (t *Timer) Month() (mon time.Month)

Month 4bits

func (*Timer) SetDay

func (t *Timer) SetDay(d int)

SetDay ...

func (*Timer) SetEn

func (t *Timer) SetEn(en bool)

SetEn ...

func (*Timer) SetHour

func (t *Timer) SetHour(h int)

SetHour ...

func (*Timer) SetMinute

func (t *Timer) SetMinute(min int)

SetMinute ...

func (*Timer) SetMonth

func (t *Timer) SetMonth(mon time.Month)

SetMonth ...

func (*Timer) SetWeek

func (t *Timer) SetWeek(w time.Weekday)

SetWeek ...

func (*Timer) Week

func (t *Timer) Week() (w time.Weekday)

Week 3bits

Jump to

Keyboard shortcuts

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