mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
优化在两个命令中使用空格分隔的体验 (#112)
* 优化在两个命令中使用空格分隔的体验 - fortune的设置底图功能 - b14的加密功能 * 优化四个插件中使用空格分隔的体验 - 加密 - 哔哩哔哩推送 - 藏头诗 - 运势 * 优化并修正了上一个commit - 加上了因为复制粘贴疏忽又没有注意测试遗漏的`?` - 调整藏头诗和加密的正则触发,使其不必多此一举 - 删去了未被发现的测试代码 * - 删去了遗漏的Trim
This commit is contained in:
parent
b372892a20
commit
2cda7ecb04
@ -20,7 +20,7 @@ func init() {
|
|||||||
Help: "base16384加解密\n" +
|
Help: "base16384加解密\n" +
|
||||||
"- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx",
|
"- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx",
|
||||||
})
|
})
|
||||||
en.OnRegex(`^加密(.*)`).SetBlock(true).
|
en.OnRegex(`^加密\s?(.*)`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
str := ctx.State["regex_matched"].([]string)[1]
|
str := ctx.State["regex_matched"].([]string)[1]
|
||||||
es, err := base14.UTF16be2utf8(base14.EncodeString(str))
|
es, err := base14.UTF16be2utf8(base14.EncodeString(str))
|
||||||
@ -30,7 +30,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("加密失败!"))
|
ctx.SendChain(message.Text("加密失败!"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex("^解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).
|
en.OnRegex(`^解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
str := ctx.State["regex_matched"].([]string)[1]
|
str := ctx.State["regex_matched"].([]string)[1]
|
||||||
es, err := base14.UTF82utf16be(helper.StringToBytes(str))
|
es, err := base14.UTF82utf16be(helper.StringToBytes(str))
|
||||||
@ -40,7 +40,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("解密失败!"))
|
ctx.SendChain(message.Text("解密失败!"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex(`^用(.*)加密(.*)`).SetBlock(true).
|
en.OnRegex(`^用(.*)加密\s?(.*)`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
|
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
|
||||||
t := getea(key)
|
t := getea(key)
|
||||||
@ -51,7 +51,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("加密失败!"))
|
ctx.SendChain(message.Text("加密失败!"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex("^用(.*)解密([\u4e00-\u8e00]*[\u3d01-\u3d06]?)$").SetBlock(true).
|
en.OnRegex(`^用(.*)解密\s?([一-踀]*[㴁-㴆]?)$`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
|
key, str := ctx.State["regex_matched"].([]string)[1], ctx.State["regex_matched"].([]string)[2]
|
||||||
t := getea(key)
|
t := getea(key)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func init() {
|
|||||||
"- 推送列表",
|
"- 推送列表",
|
||||||
})
|
})
|
||||||
|
|
||||||
en.OnRegex(`^添加订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnRegex(`^添加订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
var name string
|
var name string
|
||||||
var ok bool
|
var ok bool
|
||||||
@ -93,7 +93,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("已添加" + name + "的订阅"))
|
ctx.SendChain(message.Text("已添加" + name + "的订阅"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex(`^取消订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnRegex(`^取消订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
var name string
|
var name string
|
||||||
var ok bool
|
var ok bool
|
||||||
@ -119,7 +119,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("已取消" + name + "的订阅"))
|
ctx.SendChain(message.Text("已取消" + name + "的订阅"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex(`^取消动态订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnRegex(`^取消动态订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
var name string
|
var name string
|
||||||
var ok bool
|
var ok bool
|
||||||
@ -145,7 +145,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("已取消" + name + "的动态订阅"))
|
ctx.SendChain(message.Text("已取消" + name + "的动态订阅"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
en.OnRegex(`^取消直播订阅(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnRegex(`^取消直播订阅\s?(\d+)$`, ctxext.UserOrGrpAdmin).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
buid, _ := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64)
|
||||||
var name string
|
var name string
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|||||||
@ -37,7 +37,7 @@ func init() {
|
|||||||
Help: "藏头诗\n" +
|
Help: "藏头诗\n" +
|
||||||
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",
|
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",
|
||||||
})
|
})
|
||||||
engine.OnRegex("藏头诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
engine.OnRegex(`藏头诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
kw := ctx.State["regex_matched"].([]string)[1]
|
kw := ctx.State["regex_matched"].([]string)[1]
|
||||||
login()
|
login()
|
||||||
data, err := search(kw, "7", "0")
|
data, err := search(kw, "7", "0")
|
||||||
@ -48,7 +48,7 @@ func init() {
|
|||||||
ctx.SendChain(message.Text(text))
|
ctx.SendChain(message.Text(text))
|
||||||
})
|
})
|
||||||
|
|
||||||
engine.OnRegex("藏尾诗([\u4E00-\u9FA5]{3,10})").SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
engine.OnRegex(`藏尾诗\s?([一-龥]{3,10})$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
kw := ctx.State["regex_matched"].([]string)[1]
|
kw := ctx.State["regex_matched"].([]string)[1]
|
||||||
login()
|
login()
|
||||||
data, err := search(kw, "7", "2")
|
data, err := search(kw, "7", "2")
|
||||||
|
|||||||
@ -82,7 +82,7 @@ func init() {
|
|||||||
"- 运势 | 抽签\n" +
|
"- 运势 | 抽签\n" +
|
||||||
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘]",
|
"- 设置底图[车万 | DC4 | 爱因斯坦 | 星空列车 | 樱云之恋 | 富婆妹 | 李清歌 | 公主连结 | 原神 | 明日方舟 | 碧蓝航线 | 碧蓝幻想 | 战双 | 阴阳师 | 赛马娘]",
|
||||||
})
|
})
|
||||||
en.OnRegex(`^设置底图(.*)`).SetBlock(true).
|
en.OnRegex(`^设置底图\s?(.*)`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
gid := ctx.Event.GroupID
|
gid := ctx.Event.GroupID
|
||||||
if gid <= 0 {
|
if gid <= 0 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user