mirror of
https://github.com/fumiama/ReiBot.git
synced 2026-06-12 22:40:30 +08:00
fix: user id
This commit is contained in:
34
rule.go
34
rule.go
@@ -19,11 +19,7 @@ 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 {
|
||||||
ctx.State["manager"] = c
|
ctx.State["manager"] = c
|
||||||
var gid int64 = 0
|
return c.Handler(uintptr(unsafe.Pointer(ctx)), ctx.Message.Chat.ID, ctx.value.Elem().FieldByName("From").Elem().FieldByName("ID").Int())
|
||||||
if !ctx.Message.Chat.IsPrivate() {
|
|
||||||
gid = ctx.Message.Chat.ID
|
|
||||||
}
|
|
||||||
return c.Handler(uintptr(unsafe.Pointer(ctx)), gid, ctx.value.Elem().FieldByName("From").Elem().FieldByName("ID").Int())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,10 +33,6 @@ func init() {
|
|||||||
"响应", "response", "沉默", "silence",
|
"响应", "response", "沉默", "silence",
|
||||||
}, UserOrGrpAdmin).SetBlock(true).secondPriority().Handle(func(ctx *Ctx) {
|
}, UserOrGrpAdmin).SetBlock(true).secondPriority().Handle(func(ctx *Ctx) {
|
||||||
grp := ctx.Message.Chat.ID
|
grp := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
grp = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
msg := ""
|
msg := ""
|
||||||
switch ctx.State["command"] {
|
switch ctx.State["command"] {
|
||||||
case "响应", "response":
|
case "响应", "response":
|
||||||
@@ -74,10 +66,6 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
grp := ctx.Message.Chat.ID
|
grp := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
grp = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
if strings.Contains(model.Command, "启用") || strings.Contains(model.Command, "enable") {
|
if strings.Contains(model.Command, "启用") || strings.Contains(model.Command, "enable") {
|
||||||
service.Enable(grp)
|
service.Enable(grp)
|
||||||
if service.Options.OnEnable != nil {
|
if service.Options.OnEnable != nil {
|
||||||
@@ -123,10 +111,6 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
grp := ctx.Message.Chat.ID
|
grp := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
grp = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
service.Reset(grp)
|
service.Reset(grp)
|
||||||
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, "已还原服务的默认启用状态: "+model.Args))
|
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, "已还原服务的默认启用状态: "+model.Args))
|
||||||
})
|
})
|
||||||
@@ -144,10 +128,6 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
grp := ctx.Message.Chat.ID
|
grp := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
grp = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
msg := "**" + args[0] + "报告**"
|
msg := "**" + args[0] + "报告**"
|
||||||
issu := SuperUserPermission(ctx)
|
issu := SuperUserPermission(ctx)
|
||||||
if strings.Contains(model.Command, "允许") || strings.Contains(model.Command, "permit") {
|
if strings.Contains(model.Command, "允许") || strings.Contains(model.Command, "permit") {
|
||||||
@@ -291,10 +271,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
if service.Options.Help != "" {
|
if service.Options.Help != "" {
|
||||||
gid := ctx.Message.Chat.ID
|
gid := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
gid = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, service.EnableMarkIn(gid).String()+" "+service.String()))
|
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, service.EnableMarkIn(gid).String()+" "+service.String()))
|
||||||
} else {
|
} else {
|
||||||
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, "该服务无帮助!"))
|
_, _ = ctx.Caller.Send(tgba.NewMessage(ctx.Message.Chat.ID, "该服务无帮助!"))
|
||||||
@@ -305,10 +281,6 @@ func init() {
|
|||||||
Handle(func(ctx *Ctx) {
|
Handle(func(ctx *Ctx) {
|
||||||
i := 0
|
i := 0
|
||||||
gid := ctx.Message.Chat.ID
|
gid := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
gid = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
m.RLock()
|
m.RLock()
|
||||||
msg := make([]any, 1, len(m.M)*4+1)
|
msg := make([]any, 1, len(m.M)*4+1)
|
||||||
m.RUnlock()
|
m.RUnlock()
|
||||||
@@ -325,10 +297,6 @@ func init() {
|
|||||||
Handle(func(ctx *Ctx) {
|
Handle(func(ctx *Ctx) {
|
||||||
i := 0
|
i := 0
|
||||||
gid := ctx.Message.Chat.ID
|
gid := ctx.Message.Chat.ID
|
||||||
if ctx.Message.Chat.IsPrivate() {
|
|
||||||
// 个人用户
|
|
||||||
gid = -ctx.Message.From.ID
|
|
||||||
}
|
|
||||||
m.RLock()
|
m.RLock()
|
||||||
msgs := make([]any, 1, len(m.M)*7+1)
|
msgs := make([]any, 1, len(m.M)*7+1)
|
||||||
m.RUnlock()
|
m.RUnlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user