mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin
This commit is contained in:
commit
332bbfc0bc
202
plugin_hs/run.go
202
plugin_hs/run.go
@ -1,101 +1,101 @@
|
|||||||
package hs
|
package hs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/imroc/req"
|
"github.com/imroc/req"
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
var header = req.Header{
|
var header = req.Header{
|
||||||
"user-agent": `Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36`,
|
"user-agent": `Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36`,
|
||||||
"referer": `https://hs.fbigame.com`,
|
"referer": `https://hs.fbigame.com`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
zero.OnRegex(`^搜卡(.+)$`).
|
zero.OnRegex(`^搜卡(.+)$`).
|
||||||
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
||||||
List := ctx.State["regex_matched"].([]string)[1]
|
List := ctx.State["regex_matched"].([]string)[1]
|
||||||
g := sh(List)
|
g := sh(List)
|
||||||
im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
|
im, _ := req.Get(`https://res.fbigame.com/hs/v13/`+
|
||||||
gjson.Get(g, `list.0.CardID`).String()+
|
gjson.Get(g, `list.0.CardID`).String()+
|
||||||
`.png?auth_key=`+
|
`.png?auth_key=`+
|
||||||
gjson.Get(g, `list.0.auth_key`).String(), header)
|
gjson.Get(g, `list.0.auth_key`).String(), header)
|
||||||
im.ToFile("data/image/1.png")
|
im.ToFile("data/image/1.png")
|
||||||
file, _ := os.Open("data/image/1.png")
|
file, _ := os.Open("data/image/1.png")
|
||||||
sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{
|
sg, _ := req.Post("https://pic.sogou.com/pic/upload_pic.jsp", req.FileUpload{
|
||||||
File: file,
|
File: file,
|
||||||
FieldName: "image", // FieldName 是表单字段名
|
FieldName: "image", // FieldName 是表单字段名
|
||||||
FileName: "avatar.png", // Filename 是要上传的文件的名称,我们使用它来猜测mimetype,并将其上传到服务器上
|
FileName: "avatar.png", // Filename 是要上传的文件的名称,我们使用它来猜测mimetype,并将其上传到服务器上
|
||||||
})
|
})
|
||||||
var tx string
|
var tx string
|
||||||
t := int(gjson.Get(g, `list.#`).Int())
|
t := int(gjson.Get(g, `list.#`).Int())
|
||||||
if t == 0 {
|
if t == 0 {
|
||||||
ctx.SendChain(message.Text("查询为空!"))
|
ctx.SendChain(message.Text("查询为空!"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i := 0; i < t && i < 10; i++ {
|
for i := 0; i < t && i < 10; i++ {
|
||||||
tx += strconv.Itoa(i+1) + ". 法力:" +
|
tx += strconv.Itoa(i+1) + ". 法力:" +
|
||||||
gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() +
|
gjson.Get(g, `list.`+strconv.Itoa(i)+`.COST`).String() +
|
||||||
" " +
|
" " +
|
||||||
gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() +
|
gjson.Get(g, `list.`+strconv.Itoa(i)+`.CARDNAME`).String() +
|
||||||
"\n"
|
"\n"
|
||||||
}
|
}
|
||||||
ctx.SendChain(
|
ctx.SendChain(
|
||||||
message.Image(sg.String()),
|
message.Image(sg.String()),
|
||||||
message.Text(tx),
|
message.Text(tx),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
//卡组
|
//卡组
|
||||||
zero.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
|
zero.OnRegex(`^[\s\S]*?(AAE[a-zA-Z0-9/\+=]{70,})[\s\S]*$`).
|
||||||
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
SetBlock(true).SetPriority(20).Handle(func(ctx *zero.Ctx) {
|
||||||
fmt.Print("成功")
|
fmt.Print("成功")
|
||||||
List := ctx.State["regex_matched"].([]string)[1]
|
List := ctx.State["regex_matched"].([]string)[1]
|
||||||
ctx.SendChain(
|
ctx.SendChain(
|
||||||
message.Image(kz(List)),
|
message.Image(kz(List)),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func sh(s string) string {
|
func sh(s string) string {
|
||||||
var hs = `https://hs.fbigame.com/ajax.php`
|
var hs = `https://hs.fbigame.com/ajax.php`
|
||||||
h, _ := req.Get("https://hs.fbigame.com", header)
|
h, _ := req.Get("https://hs.fbigame.com", header)
|
||||||
var param = req.Param{
|
var param = req.Param{
|
||||||
"mod": `get_cards_list`,
|
"mod": `get_cards_list`,
|
||||||
"mode": `-1`,
|
"mode": `-1`,
|
||||||
"extend": `-1`,
|
"extend": `-1`,
|
||||||
"mutil_extend": ``,
|
"mutil_extend": ``,
|
||||||
"hero": `-1`,
|
"hero": `-1`,
|
||||||
"rarity": `-1`,
|
"rarity": `-1`,
|
||||||
"cost": `-1`,
|
"cost": `-1`,
|
||||||
"mutil_cost": ``,
|
"mutil_cost": ``,
|
||||||
"techlevel": `-1`,
|
"techlevel": `-1`,
|
||||||
"type": `-1`,
|
"type": `-1`,
|
||||||
"collectible": `-1`,
|
"collectible": `-1`,
|
||||||
"isbacon": `-1`,
|
"isbacon": `-1`,
|
||||||
"page": `1`,
|
"page": `1`,
|
||||||
"search_type": `1`,
|
"search_type": `1`,
|
||||||
"deckmode": "normal",
|
"deckmode": "normal",
|
||||||
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
|
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
|
||||||
}
|
}
|
||||||
r, _ := req.Get(hs, header, param, req.Param{"search": s})
|
r, _ := req.Get(hs, header, param, req.Param{"search": s})
|
||||||
return r.String()
|
return r.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func kz(s string) string {
|
func kz(s string) string {
|
||||||
h, _ := req.Get("https://hs.fbigame.com")
|
h, _ := req.Get("https://hs.fbigame.com")
|
||||||
param := req.Param{
|
param := req.Param{
|
||||||
"mod": `general_deck_image`,
|
"mod": `general_deck_image`,
|
||||||
"deck_code": s,
|
"deck_code": s,
|
||||||
"deck_text": ``,
|
"deck_text": ``,
|
||||||
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
|
"hash": strings.SplitN(strings.SplitN(h.String(), `var hash = "`, 2)[1], `"`, 2)[0],
|
||||||
}
|
}
|
||||||
r, _ := req.Get(`https://hs.fbigame.com/ajax.php`, param, h.Request().Header)
|
r, _ := req.Get(`https://hs.fbigame.com/ajax.php`, param, h.Request().Header)
|
||||||
im := gjson.Get(r.String(), "img").String()
|
im := gjson.Get(r.String(), "img").String()
|
||||||
return `base64://` + im
|
return `base64://` + im
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user