File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22package kfccrazythursday
33
44import (
5- "encoding/json"
6-
75 "github.com/FloatTech/floatbox/web"
86 ctrl "github.com/FloatTech/zbpctrl"
97 "github.com/FloatTech/zbputils/control"
@@ -15,12 +13,6 @@ const (
1513 crazyURL = "https://api.pearktrue.cn/api/kfc/"
1614)
1715
18- type crazyResponse struct {
19- Code int `json:"code"`
20- Msg string `json:"msg"`
21- Text string `json:"text"`
22- }
23-
2416func init () {
2517 engine := control .AutoRegister (& ctrl.Options [* zero.Ctx ]{
2618 DisableOnDefault : false ,
@@ -34,17 +26,7 @@ func init() {
3426 return
3527 }
3628
37- var resp crazyResponse
38- if err := json .Unmarshal (data , & resp ); err != nil {
39- ctx .SendChain (message .Text ("JSON解析失败: " , err ))
40- return
41- }
42-
43- if resp .Code != 200 {
44- ctx .SendChain (message .Text ("API返回错误: " , resp .Msg ))
45- return
46- }
47-
48- ctx .SendChain (message .Text (resp .Text ))
29+ // 根据来源API修改返回方式到直接输出文本
30+ ctx .SendChain (message .Text (string (data )))
4931 })
5032}
You can’t perform that action at this time.
0 commit comments