mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-05 00:50:25 +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 {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user