mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
chore: del dress due to 删库
This commit is contained in:
parent
b09025a330
commit
879948a5c4
14
README.md
14
README.md
@ -638,20 +638,6 @@ print("run[CQ:image,file="+j["img"]+"]")
|
|||||||
|
|
||||||
- [x] 删签[gif签名]
|
- [x] 删签[gif签名]
|
||||||
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>女装</summary>
|
|
||||||
|
|
||||||
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress"`
|
|
||||||
|
|
||||||
- [x] 女装
|
|
||||||
|
|
||||||
- [x] 男装
|
|
||||||
|
|
||||||
- [x] 随机女装
|
|
||||||
|
|
||||||
- [x] 随机男装
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
<summary>漂流瓶</summary>
|
<summary>漂流瓶</summary>
|
||||||
|
|||||||
1
main.go
1
main.go
@ -82,7 +82,6 @@ import (
|
|||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/dish" // 程序员做饭指南
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/dish" // 程序员做饭指南
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/dress" // 女装
|
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
|
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
|
||||||
coserURL = "http://ovooa.com/API/cosplay/api.php"
|
coserURL = "https://picture.yinux.workers.dev"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@ -24,14 +24,11 @@ func init() {
|
|||||||
engine.OnFullMatch(`今日早报`).SetBlock(true).
|
engine.OnFullMatch(`今日早报`).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
data, err := web.GetData(api)
|
data, err := web.GetData(api)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String()
|
||||||
ctx.SendChain(message.Image(picURL))
|
ctx.SendChain(message.Image(picURL))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ func init() {
|
|||||||
))
|
))
|
||||||
})
|
})
|
||||||
|
|
||||||
en.OnPrefixGroup([]string{"随机菜谱", "随便做点菜"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
en.OnFullMatchGroup([]string{"随机菜谱", "随便做点菜"}).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
|
||||||
if !initialized {
|
if !initialized {
|
||||||
ctx.SendChain(message.Text("客官,本店暂未开业"))
|
ctx.SendChain(message.Text("客官,本店暂未开业"))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
package dress
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/FloatTech/floatbox/web"
|
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
dressURL = "http://www.yoooooooooo.com/gitdress"
|
|
||||||
male = "dress"
|
|
||||||
female = "girldress"
|
|
||||||
dressListURL = dressURL + "/%v/album/list.json"
|
|
||||||
dressDetailURL = dressURL + "/%v/album/%v/info.json"
|
|
||||||
dressImageURL = dressURL + "/%v/album/%v/%v-m.webp"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dressList(sex string) (dressList []string, err error) {
|
|
||||||
data, err := web.GetData(fmt.Sprintf(dressListURL, sex))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
arr := gjson.ParseBytes(data).Get("@this").Array()
|
|
||||||
dressList = make([]string, len(arr))
|
|
||||||
for i, v := range arr {
|
|
||||||
dressList[i] = v.String()
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func detail(sex, name string) (count int, err error) {
|
|
||||||
data, err := web.GetData(fmt.Sprintf(dressDetailURL, sex, name))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
count = int(gjson.ParseBytes(data).Get("@this.#").Int())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
// Package dress 女装
|
|
||||||
package dress
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"math/rand"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/FloatTech/floatbox/binary"
|
|
||||||
ctrl "github.com/FloatTech/zbpctrl"
|
|
||||||
"github.com/FloatTech/zbputils/control"
|
|
||||||
"github.com/FloatTech/zbputils/ctxext"
|
|
||||||
"github.com/FloatTech/zbputils/img/text"
|
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() { // 插件主体
|
|
||||||
engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
|
|
||||||
DisableOnDefault: false,
|
|
||||||
Brief: "女装",
|
|
||||||
Help: "女装\n" +
|
|
||||||
"- 女装\n" +
|
|
||||||
"- 男装\n" +
|
|
||||||
"- 随机女装\n" +
|
|
||||||
"- 随机男装",
|
|
||||||
PrivateDataFolder: "dress",
|
|
||||||
})
|
|
||||||
engine.OnFullMatchGroup([]string{"女装", "男装"}).SetBlock(true).
|
|
||||||
Handle(func(ctx *zero.Ctx) {
|
|
||||||
matched := ctx.State["matched"].(string)
|
|
||||||
sex := male
|
|
||||||
if matched == "男装" {
|
|
||||||
sex = female
|
|
||||||
}
|
|
||||||
next := zero.NewFutureEvent("message", 999, false, ctx.CheckSession())
|
|
||||||
recv, cancel := next.Repeat()
|
|
||||||
defer cancel()
|
|
||||||
nameList, err := dressList(sex)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
tex := "请输入" + matched + "序号\n"
|
|
||||||
for i, v := range nameList {
|
|
||||||
tex += fmt.Sprintf("%d. %s\n", i, v)
|
|
||||||
}
|
|
||||||
base64Str, err := text.RenderToBase64(tex, text.FontFile, 400, 20)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.SendChain(message.Image("base64://" + binary.BytesToString(base64Str)))
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-time.After(time.Second * 120):
|
|
||||||
ctx.SendChain(message.Text(matched, "指令过期"))
|
|
||||||
return
|
|
||||||
case c := <-recv:
|
|
||||||
msg := c.Event.Message.ExtractPlainText()
|
|
||||||
num, err := strconv.Atoi(msg)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("请输入数字!"))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if num < 0 || num >= len(nameList) {
|
|
||||||
ctx.SendChain(message.Text("序号非法!"))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
name := nameList[num]
|
|
||||||
sendImage(ctx, sex, matched, name)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
engine.OnFullMatchGroup([]string{"随机女装", "随机男装"}).SetBlock(true).
|
|
||||||
Handle(func(ctx *zero.Ctx) {
|
|
||||||
matched := strings.TrimPrefix(ctx.State["matched"].(string), "随机")
|
|
||||||
sex := male
|
|
||||||
if matched == "男装" {
|
|
||||||
sex = female
|
|
||||||
}
|
|
||||||
nameList, err := dressList(sex)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
name := nameList[rand.Intn(len(nameList))]
|
|
||||||
sendImage(ctx, sex, matched, name)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendImage(ctx *zero.Ctx, sex, matched, name string) {
|
|
||||||
ctx.SendChain(message.Text("请欣赏", matched, ": ", name))
|
|
||||||
count, err := detail(sex, name)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
imageList := make([]string, count)
|
|
||||||
for i := range imageList {
|
|
||||||
imageList[i] = fmt.Sprintf(dressImageURL, sex, name, i+1)
|
|
||||||
}
|
|
||||||
m := message.Message{}
|
|
||||||
for _, v := range imageList {
|
|
||||||
m = append(m, ctxext.FakeSenderForwardNode(ctx, message.Image(v)))
|
|
||||||
}
|
|
||||||
if id := ctx.Send(m).ID(); id == 0 {
|
|
||||||
ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user