MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / CancelTimer

Method CancelTimer

plugin/manager/timer/timer.go:121–140  ·  view source on GitHub ↗

CancelTimer 取消计时器

(key uint32)

Source from the content-addressed store, hash-verified

119
120// CancelTimer 取消计时器
121func (c *Clock) CancelTimer(key uint32) bool {
122 t, ok := c.GetTimer(key)
123 if ok {
124 if t.Cron != "" {
125 c.entmu.Lock()
126 e := c.entries[key]
127 c.cron.Remove(e)
128 delete(c.entries, key)
129 c.entmu.Unlock()
130 } else {
131 t.SetEn(false)
132 }
133 c.timersmu.Lock()
134 delete(*c.timers, key) // 避免重复取消
135 e := c.db.Del("timer", "WHERE id = ?", key)
136 c.timersmu.Unlock()
137 return e == nil
138 }
139 return false
140}
141
142// ListTimers 列出本群所有计时器
143func (c *Clock) ListTimers(grpID int64) []string {

Callers 1

initFunction · 0.80

Calls 2

GetTimerMethod · 0.95
SetEnMethod · 0.80

Tested by

no test coverage detected