From b60c37f6278ab017096545e2005a0b9ce8ef6ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 11 Jun 2022 01:21:01 +0800 Subject: [PATCH] fix ctrl --- rule.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/rule.go b/rule.go index a0a5e2a..6da2cd1 100644 --- a/rule.go +++ b/rule.go @@ -20,17 +20,12 @@ import ( func newctrl(service string, o *ctrl.Options[*Ctx]) Rule { c := m.NewControl(service, o) return func(ctx *Ctx) bool { - msg, ok := ctx.Value.(*tgba.Message) - if !ok { - return false - } ctx.State["manager"] = c - ctx.Message = msg var gid int64 = 0 - if !msg.Chat.IsPrivate() { - gid = msg.Chat.ID + if !ctx.Message.Chat.IsPrivate() { + gid = ctx.Message.Chat.ID } - return c.Handler(uintptr(unsafe.Pointer(ctx)), gid, msg.From.ID) + return c.Handler(uintptr(unsafe.Pointer(ctx)), gid, ctx.Message.From.ID) } }