1
0
mirror of https://github.com/fumiama/ReiBot.git synced 2026-06-11 21:50:35 +08:00
This commit is contained in:
源文雨
2022-06-11 01:21:01 +08:00
parent cc43153a54
commit b60c37f627

11
rule.go
View File

@@ -20,17 +20,12 @@ import (
func newctrl(service string, o *ctrl.Options[*Ctx]) Rule { func newctrl(service string, o *ctrl.Options[*Ctx]) Rule {
c := m.NewControl(service, o) c := m.NewControl(service, o)
return func(ctx *Ctx) bool { return func(ctx *Ctx) bool {
msg, ok := ctx.Value.(*tgba.Message)
if !ok {
return false
}
ctx.State["manager"] = c ctx.State["manager"] = c
ctx.Message = msg
var gid int64 = 0 var gid int64 = 0
if !msg.Chat.IsPrivate() { if !ctx.Message.Chat.IsPrivate() {
gid = msg.Chat.ID 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)
} }
} }