fix: baidu 正则匹配 (#636)

This commit is contained in:
anyanfei 2023-03-24 14:03:18 +08:00 committed by GitHub
parent 1376803b07
commit 500dcaa9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ func init() { // 主函数
Help: "百度百科\n" + Help: "百度百科\n" +
"- 百度/百科[关键字]", "- 百度/百科[关键字]",
}) })
en.OnRegex(`^[百度|百科]\s*(.+)$`).SetBlock(true).Handle(func(ctx *zero.Ctx) { en.OnRegex(`^[度科]\s*(.+)$`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
es, err := web.GetData(fmt.Sprintf(api, ctx.State["regex_matched"].([]string)[1])) // 将网站返回结果赋值 es, err := web.GetData(fmt.Sprintf(api, ctx.State["regex_matched"].([]string)[1])) // 将网站返回结果赋值
if err != nil { if err != nil {
ctx.SendChain(message.Text("出现错误捏:", err)) ctx.SendChain(message.Text("出现错误捏:", err))