✏️ 减少指令误触发

This commit is contained in:
Yiwen-Chan 2021-03-22 13:07:10 +08:00
parent 3eee3d64f1
commit 184b12628f
3 changed files with 8 additions and 8 deletions

View File

@ -10,7 +10,7 @@ import (
func init() { // 插件主体 func init() { // 插件主体
// TODO 根据PID搜图 // TODO 根据PID搜图
zero.OnRegex(`点歌(.*)`).SetBlock(true).SetPriority(50). zero.OnRegex(`^点歌(.*)$`).SetBlock(true).SetPriority(50).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
music, err := utils.CloudMusic(ctx.State["regex_matched"].([]string)[1]) music, err := utils.CloudMusic(ctx.State["regex_matched"].([]string)[1])
if err != nil { if err != nil {

View File

@ -9,7 +9,7 @@ import (
func init() { // 插件主体 func init() { // 插件主体
// TODO 根据PID搜图 // TODO 根据PID搜图
zero.OnRegex(`搜图(\d+)`).SetBlock(true).SetPriority(30). zero.OnRegex(`^搜图(\d+)$`).SetBlock(true).SetPriority(30).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
id := utils.Str2Int(ctx.State["regex_matched"].([]string)[1]) id := utils.Str2Int(ctx.State["regex_matched"].([]string)[1])
ctx.Send("少女祈祷中......") ctx.Send("少女祈祷中......")

View File

@ -44,7 +44,7 @@ func init() {
} }
func init() { // 插件主体 func init() { // 插件主体
zero.OnRegex(`来份(.*)`, FirstValueInList(PoolList)).SetBlock(true).SetPriority(20). zero.OnRegex(`^来份(.*)$`, FirstValueInList(PoolList)).SetBlock(true).SetPriority(20).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
if limit.Load(ctx.Event.UserID).Acquire() == false { if limit.Load(ctx.Event.UserID).Acquire() == false {
ctx.Send("请稍后重试0x0...") ctx.Send("请稍后重试0x0...")
@ -95,7 +95,7 @@ func init() { // 插件主体
return return
}) })
zero.OnRegex(`添加(.*?)(\d+)`, FirstValueInList(PoolList), zero.SuperUserPermission).SetBlock(true).SetPriority(21). zero.OnRegex(`^添加(.*?)(\d+)$`, FirstValueInList(PoolList), zero.SuperUserPermission).SetBlock(true).SetPriority(21).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
var ( var (
type_ = ctx.State["regex_matched"].([]string)[1] type_ = ctx.State["regex_matched"].([]string)[1]
@ -128,7 +128,7 @@ func init() { // 插件主体
return return
}) })
zero.OnRegex(`删除(.*?)(\d+)`, FirstValueInList(PoolList), zero.SuperUserPermission).SetBlock(true).SetPriority(22). zero.OnRegex(`^删除(.*?)(\d+)$`, FirstValueInList(PoolList), zero.SuperUserPermission).SetBlock(true).SetPriority(22).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
var ( var (
type_ = ctx.State["regex_matched"].([]string)[1] type_ = ctx.State["regex_matched"].([]string)[1]
@ -144,7 +144,7 @@ func init() { // 插件主体
}) })
// TODO 查询数据库涩图数量 // TODO 查询数据库涩图数量
zero.OnFullMatchGroup([]string{"setu -s", "setu --status"}, zero.SuperUserPermission).SetBlock(true).SetPriority(23). zero.OnFullMatchGroup([]string{"setu -s", "setu --status"}).SetBlock(true).SetPriority(23).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
state := []string{"[SetuTime]"} state := []string{"[SetuTime]"}
for i := range PoolList { for i := range PoolList {
@ -161,14 +161,14 @@ func init() { // 插件主体
return return
}) })
// TODO 开xml模式 // TODO 开xml模式
zero.OnFullMatchGroup([]string{"setu -x", "setu --xml"}, zero.AdminPermission).SetBlock(true).SetPriority(24). zero.OnFullMatchGroup([]string{"setu -x", "setu --xml"}).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
FORM = "XML" FORM = "XML"
ctx.Send("[SetuTime] XML->ON") ctx.Send("[SetuTime] XML->ON")
return return
}) })
// TODO 关xml模式 // TODO 关xml模式
zero.OnFullMatchGroup([]string{"setu -p", "setu --pic"}, zero.AdminPermission).SetBlock(true).SetPriority(24). zero.OnFullMatchGroup([]string{"setu -p", "setu --pic"}).SetBlock(true).SetPriority(24).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
FORM = "PIC" FORM = "PIC"
ctx.Send("[SetuTime] XML->OFF") ctx.Send("[SetuTime] XML->OFF")