mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
Update nbnhhsh.go
This commit is contained in:
parent
c724be743d
commit
83199cf3aa
@ -23,19 +23,25 @@ func init() {
|
|||||||
func getValue(text string) []string {
|
func getValue(text string) []string {
|
||||||
urlValues := url.Values{}
|
urlValues := url.Values{}
|
||||||
urlValues.Add("text", text)
|
urlValues.Add("text", text)
|
||||||
resp, _ := http.PostForm("https://lab.magiconch.com/api/nbnhhsh/guess", urlValues)
|
resp, err := http.PostForm("https://lab.magiconch.com/api/nbnhhsh/guess", urlValues)
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
if err == nil {
|
||||||
resp.Close()
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
json := gjson.ParseBytes(body)
|
if err == nil {
|
||||||
res := make([]string, 0)
|
resp.Body.Close()
|
||||||
var jsonPath string
|
json := gjson.ParseBytes(body)
|
||||||
if json.Get("0.trans").Exists() {
|
res := make([]string, 0)
|
||||||
jsonPath = "0.trans"
|
var jsonPath string
|
||||||
} else {
|
if json.Get("0.trans").Exists() {
|
||||||
jsonPath = "0.inputting"
|
jsonPath = "0.trans"
|
||||||
|
} else {
|
||||||
|
jsonPath = "0.inputting"
|
||||||
|
}
|
||||||
|
for _, value := range json.Get(jsonPath).Array() {
|
||||||
|
res = append(res, value.String())
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
return []string{err.Error()}
|
||||||
}
|
}
|
||||||
for _, value := range json.Get(jsonPath).Array() {
|
return []string{err.Error()}
|
||||||
res = append(res, value.String())
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user