mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
chore: del heisi due to 跑路
This commit is contained in:
parent
879948a5c4
commit
4334f4dd22
@ -761,14 +761,6 @@ print("run[CQ:image,file="+j["img"]+"]")
|
|||||||
- [x] 下载歌单[网易云歌单链接/ID]到[歌单名称]
|
- [x] 下载歌单[网易云歌单链接/ID]到[歌单名称]
|
||||||
- [x] 解除绑定 [歌单名称]
|
- [x] 解除绑定 [歌单名称]
|
||||||
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>黑丝</summary>
|
|
||||||
|
|
||||||
`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi"`
|
|
||||||
|
|
||||||
- [x] 来点黑丝/白丝/jk/巨乳/足控/网红
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
<summary>一言</summary>
|
<summary>一言</summary>
|
||||||
|
|||||||
1
main.go
1
main.go
@ -92,7 +92,6 @@ import (
|
|||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/heisi" // 黑丝
|
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hitokoto" // 一言
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hitokoto" // 一言
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首
|
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首
|
||||||
|
|||||||
@ -1,119 +0,0 @@
|
|||||||
// Package heisi 黑丝
|
|
||||||
package heisi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/FloatTech/AnimeAPI/setu"
|
|
||||||
fbctxext "github.com/FloatTech/floatbox/ctxext"
|
|
||||||
"github.com/FloatTech/floatbox/file"
|
|
||||||
"github.com/FloatTech/floatbox/web"
|
|
||||||
ctrl "github.com/FloatTech/zbpctrl"
|
|
||||||
"github.com/FloatTech/zbputils/control"
|
|
||||||
"github.com/FloatTech/zbputils/ctxext"
|
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
heisiPic []item
|
|
||||||
baisiPic []item
|
|
||||||
jkPic []item
|
|
||||||
jurPic []item
|
|
||||||
zukPic []item
|
|
||||||
mcnPic []item
|
|
||||||
fileList = [...]string{"heisi.bin", "baisi.bin", "jk.bin", "jur.bin", "zuk.bin", "mcn.bin"}
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() { // 插件主体
|
|
||||||
p, err := setu.NewPool(setu.DefaultPoolDir,
|
|
||||||
func(s string) (string, error) {
|
|
||||||
if s != "黑丝" && s != "白丝" && s != "jk" && s != "巨乳" && s != "足控" && s != "网红" {
|
|
||||||
return "", errors.New("invalid call")
|
|
||||||
}
|
|
||||||
typ := setu.DefaultPoolDir + "/" + s
|
|
||||||
if file.IsNotExist(typ) {
|
|
||||||
err := os.MkdirAll(typ, 0755)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var pic item
|
|
||||||
switch s {
|
|
||||||
case "黑丝":
|
|
||||||
pic = heisiPic[rand.Intn(len(heisiPic))]
|
|
||||||
case "白丝":
|
|
||||||
pic = baisiPic[rand.Intn(len(baisiPic))]
|
|
||||||
case "jk":
|
|
||||||
pic = jkPic[rand.Intn(len(jkPic))]
|
|
||||||
case "巨乳":
|
|
||||||
pic = jurPic[rand.Intn(len(jurPic))]
|
|
||||||
case "足控":
|
|
||||||
pic = zukPic[rand.Intn(len(zukPic))]
|
|
||||||
case "网红":
|
|
||||||
pic = mcnPic[rand.Intn(len(mcnPic))]
|
|
||||||
}
|
|
||||||
return pic.String(), nil
|
|
||||||
}, func(s string) ([]byte, error) {
|
|
||||||
return web.RequestDataWith(web.NewTLS12Client(), s, "GET", "http://hs.heisiwu.com/", web.RandUA(), nil)
|
|
||||||
}, time.Minute)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
|
|
||||||
DisableOnDefault: false,
|
|
||||||
Brief: "黑丝",
|
|
||||||
Help: "- 来点黑丝\n- 来点白丝\n- 来点jk\n- 来点巨乳\n- 来点足控\n- 来点网红",
|
|
||||||
PublicDataFolder: "Heisi",
|
|
||||||
})
|
|
||||||
|
|
||||||
engine.OnFullMatchGroup([]string{"来点黑丝", "来点白丝", "来点jk", "来点巨乳", "来点足控", "来点网红"}, zero.OnlyGroup, fbctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
|
|
||||||
for i, filePath := range fileList {
|
|
||||||
data, err := engine.GetLazyData(filePath, true)
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if len(data)%10 != 0 {
|
|
||||||
ctx.SendChain(message.Text("ERROR: invalid data " + strconv.Itoa(i)))
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
s := (*slice)(unsafe.Pointer(&data))
|
|
||||||
s.len /= 10
|
|
||||||
s.cap /= 10
|
|
||||||
switch i {
|
|
||||||
case 0:
|
|
||||||
heisiPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
case 1:
|
|
||||||
baisiPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
case 2:
|
|
||||||
jkPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
case 3:
|
|
||||||
jurPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
case 4:
|
|
||||||
zukPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
case 5:
|
|
||||||
mcnPic = *(*[]item)(unsafe.Pointer(s))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})).SetBlock(true).
|
|
||||||
Handle(func(ctx *zero.Ctx) {
|
|
||||||
matched := ctx.State["matched"].(string)
|
|
||||||
pic, err := p.Roll(matched[3*2:])
|
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
m := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Image("file:///"+file.BOTPATH+"/"+pic))}
|
|
||||||
if id := ctx.Send(m).ID(); id == 0 {
|
|
||||||
ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待"))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
package heisi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/binary"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"math/bits"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
template2021 = "http://hs.heisiwu.com/wp-content/uploads/%4d/%02d/%4d%02d16%06d-611a3%8s.jpg"
|
|
||||||
templategeneral = "http://hs.heisiwu.com/wp-content/uploads/%4d/%02d/%015x"
|
|
||||||
)
|
|
||||||
|
|
||||||
type item [10]byte
|
|
||||||
|
|
||||||
// String item to url
|
|
||||||
func (it item) String() string {
|
|
||||||
year, month := int((it[0]>>4)&0x0f), int(it[0]&0x0f)
|
|
||||||
year += 2021
|
|
||||||
if year == 2021 {
|
|
||||||
num := binary.BigEndian.Uint32(it[1:5])
|
|
||||||
dstr := hex.EncodeToString(it[5:9])
|
|
||||||
return fmt.Sprintf(template2021, year, month, year, month, num, dstr)
|
|
||||||
}
|
|
||||||
d := binary.BigEndian.Uint64(it[1:9])
|
|
||||||
isscaled := it[9]&0x80 > 0
|
|
||||||
num := int(it[9] & 0x7f)
|
|
||||||
trestore := fmt.Sprintf(templategeneral, year, month, d&0x0fffffff_ffffffff)
|
|
||||||
if num > 0 {
|
|
||||||
trestore += fmt.Sprintf("-%d", num)
|
|
||||||
}
|
|
||||||
if isscaled {
|
|
||||||
trestore += "-scaled"
|
|
||||||
}
|
|
||||||
d = bits.RotateLeft64(d, 4) & 0x0f
|
|
||||||
switch d {
|
|
||||||
case 0:
|
|
||||||
trestore += ".jpg"
|
|
||||||
case 1:
|
|
||||||
trestore += ".png"
|
|
||||||
case 2:
|
|
||||||
trestore += ".webp"
|
|
||||||
default:
|
|
||||||
return "invalid ext"
|
|
||||||
}
|
|
||||||
return trestore
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package heisi
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
// slice is the runtime representation of a slice.
|
|
||||||
// It cannot be used safely or portably and its representation may
|
|
||||||
// change in a later release.
|
|
||||||
//
|
|
||||||
// Unlike reflect.SliceHeader, its Data field is sufficient to guarantee the
|
|
||||||
// data it references will not be garbage collected.
|
|
||||||
type slice struct {
|
|
||||||
data unsafe.Pointer
|
|
||||||
len int
|
|
||||||
cap int
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user