@@ -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
@@ -232,7 +232,7 @@ func init() {
232232 args := []any {}
233233 if ctx .Event .GroupID != 0 {
234234 grp := strconv .FormatInt (ctx .Event .GroupID , 36 )
235- q = "WHERE cron LIKE 'fm:%' OR cron LIKE 'sm:%' OR cron LIKE ? OR cron LIKE ? "
235+ q = "WHERE cron LIKE 'fm:%' OR cron LIKE 'sm:%' OR cron LIKE '?' OR cron LIKE '?' "
236236 args = []any {"_m:" + grp + ":%" , "_p:" + grp + ":?:%" }
237237 lst = append (lst , "在本群的触发指令]\n " )
238238 } else {
@@ -262,7 +262,7 @@ func init() {
262262 return
263263 }
264264 lst := make ([]string , 0 , n )
265- err = db .FindFor (ids , c , "WHERE cron = ? " , func () error {
265+ err = db .FindFor (ids , c , "WHERE cron = '?' " , func () error {
266266 lst = append (lst , c .Cmd + "\n " )
267267 return nil
268268 }, cron )
@@ -291,7 +291,7 @@ func init() {
291291 return
292292 }
293293 lst := make ([]string , 0 , n )
294- err = db .FindFor (ids , c , "WHERE cron = ? " , func () error {
294+ err = db .FindFor (ids , c , "WHERE cron = '?' " , func () error {
295295 lst = append (lst , c .Cmd + "\n " )
296296 return nil
297297 }, cron )
@@ -441,19 +441,19 @@ 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 ()
448448 bots := strconv .FormatInt (bot , 36 )
449449 e := new (zero.Event )
450450 var delids []int64
451- err := db .FindFor (bots , c , "WHERE cron = ? OR cron LIKE ? " , func () error {
451+ err := db .FindFor (bots , c , "WHERE cron = '?' OR cron LIKE '?' " , func () error {
452452 err := json .Unmarshal (binary .StringToBytes (c .Cmd ), e )
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 ]
@@ -480,7 +480,7 @@ func delcmd(bot int64, cron string) error {
480480 defer mu .Unlock ()
481481 bots := strconv .FormatInt (bot , 36 )
482482 var delids []int64
483- err := db .FindFor (bots , c , "WHERE cron = ? " , func () error {
483+ err := db .FindFor (bots , c , "WHERE cron = '?' " , func () error {
484484 m , ok := matchers [c .ID ]
485485 if ok {
486486 m .Delete ()
0 commit comments