timer

package
v1.2.2-beta1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

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
}

func NewClock

func NewClock(pbfile string) (c Clock)

func (*Clock) CancelTimer

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

CancelTimer 取消计时器

func (*Clock) GetTimer

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

func (*Clock) ListTimers

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

ListTimers 列出本群所有计时器

func (*Clock) RegisterTimer

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

RegisterTimer 注册计时器

func (*Clock) SaveTimers

func (c *Clock) SaveTimers() error

SaveTimers 保存当前计时器

type Timer

type Timer struct {
	Alert                       string `protobuf:"bytes,1,opt"`
	Cron                        string `protobuf:"bytes,2,opt"`
	En1Month4Day5Week3Hour5Min6 int32  `protobuf:"varint,4,opt"`
	Selfid                      int64  `protobuf:"varint,8,opt"`
	Url                         string `protobuf:"bytes,16,opt"`
}

func GetFilledCronTimer

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

GetFilledCronTimer 获得以cron填充好的ts

func GetFilledTimer

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

GetFilledTimer 获得填充好的ts

func (*Timer) Day

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

func (*Timer) En

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

func (*Timer) GetTimerInfo

func (ts *Timer) GetTimerInfo(grp int64) string

GetTimerInfo 获得标准化定时字符串

func (*Timer) Hour

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

func (*Timer) Minute

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

func (*Timer) Month

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

func (*Timer) SetDay

func (m *Timer) SetDay(d int)

func (*Timer) SetEn

func (m *Timer) SetEn(en bool)

func (*Timer) SetHour

func (m *Timer) SetHour(h int)

func (*Timer) SetMinute

func (m *Timer) SetMinute(min int)

func (*Timer) SetMonth

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

func (*Timer) SetWeek

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

func (*Timer) Week

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

type TimersMap

type TimersMap struct {
	Timers map[string]*Timer `protobuf:"bytes,1,rep" protobuf_key:"bytes,1,opt" protobuf_val:"bytes,2,opt"`
}

Jump to

Keyboard shortcuts

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