🎨 优化 ERROR 格式

This commit is contained in:
fumiama
2022-08-16 15:15:29 +08:00
parent b4d6e1ef04
commit 70713c0719
58 changed files with 284 additions and 284 deletions

View File

@@ -11,12 +11,12 @@ func init() {
engine.OnFullMatch("马丁路德骂我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
doc, err := htmlquery.LoadURL(ergofabulousURL)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
node, err := htmlquery.Query(doc, "//main[@role=\"main\"]/p[@class=\"larger\"]/text()")
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(node.Data))

View File

@@ -39,7 +39,7 @@ func init() {
requestURL := sdMap[ctx.State["matched"].(string)]
data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", sdReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(gjson.GetBytes(data, "data.text").String()))

View File

@@ -14,7 +14,7 @@ func init() {
engine.OnFullMatch("来碗绿茶").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.RequestDataWith(web.NewDefaultClient(), chayiURL, "GET", loveliveReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
text := gjson.Get(helper.BytesToString(data), "returnObj.content").String()
@@ -24,7 +24,7 @@ func init() {
engine.OnFullMatch("渣我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.RequestDataWith(web.NewDefaultClient(), ganhaiURL, "GET", loveliveReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
text := gjson.Get(helper.BytesToString(data), "returnObj.content").String()

View File

@@ -16,7 +16,7 @@ func init() {
engine.OnFullMatch("讲个段子").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
data, err := web.RequestDataWith(web.NewDefaultClient(), yduanziURL, "POST", yduanziReferer, ua)
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
ctx.SendChain(message.Text("ERROR: ", err))
return
}
text := gjson.Get(helper.BytesToString(data), "duanzi").String()