mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-11 21:50:35 +08:00
fix ctrl
This commit is contained in:
11
rule.go
11
rule.go
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user