From 3bf7903197bff0cc1392fb2dd4376c3fbc672acb Mon Sep 17 00:00:00 2001 From: Kajiekazz <719571357@qq.com> Date: Tue, 13 Oct 2026 20:48:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(timer):=20=E4=BF=AE=E5=A4=8Dqq=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E6=97=B6=E5=AE=9A=E6=97=B6=E5=99=A8=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/manager/timer/msg.go | 3 +++ plugin/manager/timer/timer.go | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/manager/timer/msg.go b/plugin/manager/timer/msg.go index 64de291044..0633ba77c9 100644 --- a/plugin/manager/timer/msg.go +++ b/plugin/manager/timer/msg.go @@ -6,6 +6,9 @@ import ( ) func (t *Timer) sendmsg(grp int64, ctx *zero.Ctx) { + if ctx == nil { + return + } ctx.Event = new(zero.Event) ctx.Event.GroupID = grp if t.URL == "" { diff --git a/plugin/manager/timer/timer.go b/plugin/manager/timer/timer.go index 43a7254017..d42a1e0bf1 100644 --- a/plugin/manager/timer/timer.go +++ b/plugin/manager/timer/timer.go @@ -77,7 +77,13 @@ func (c *Clock) RegisterTimer(ts *Timer, save, isinit bool) bool { if isinit { process.GlobalInitMutex.Unlock() } - eid, err := c.cron.AddFunc(ts.Cron, func() { ts.sendmsg(ts.GrpID, ctx) }) + eid, err := c.cron.AddFunc(ts.Cron, func() { + bot := ctx + if ts.SelfID != 0 { + bot = zero.GetBot(ts.SelfID) + } + ts.sendmsg(ts.GrpID, bot) + }) if err == nil { c.entmu.Lock() c.entries[key] = eid