Skip to content

Commit 058e1af

Browse files
committed
fix(job): cannot delete records
1 parent b554b70 commit 058e1af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

job/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func init() {
194194
})
195195
en.OnRegex(`^取消在"(.*)"触发的指令$`, zero.UserOrGrpAdmin, isfirstregmatchnotnil).SetBlock(true).Handle(func(ctx *zero.Ctx) {
196196
cron := ctx.State["regex_matched"].([]string)[1]
197-
err := rmcmd(ctx.Event.SelfID, ctx.Event.UserID, cron)
197+
err := rmcmd(ctx.Event.SelfID, ctx.Event.UserID, cron, zero.AdminPermission(ctx))
198198
if err != nil {
199199
ctx.SendChain(message.Text("ERROR: ", err))
200200
return
@@ -441,7 +441,7 @@ func superuserhandler(rsp []byte) (zero.Handler, error) {
441441
}, nil
442442
}
443443

444-
func rmcmd(bot, caller int64, cron string) error {
444+
func rmcmd(bot, caller int64, cron string, force bool) error {
445445
c := &cmd{}
446446
mu.Lock()
447447
defer mu.Unlock()
@@ -453,7 +453,7 @@ func rmcmd(bot, caller int64, cron string) error {
453453
if err != nil {
454454
return err
455455
}
456-
if e.UserID != caller {
456+
if !force && e.UserID != caller {
457457
return nil
458458
}
459459
eid, ok := entries[c.ID]

0 commit comments

Comments
 (0)