Compare commits

..

15 Commits

Author SHA1 Message Date
fumiama
a2426de70c Squashed commit of the following:
commit 3e4b0216b9f952b800e9be880acd744af3afe593
Merge: 970cb14 aaf832e
Author: fumiama <s862105088@gmail.com>
Date:   Sat Feb 12 23:23:51 2022 +0800

    Merge branch 'master' of https://github.com/MoYoez/ZeroBot-Plugin into MoYoez-master

commit 970cb142256d4575b3e5170b9dfb9370f5802da5
Author: fumiama <s862105088@gmail.com>
Date:   Sat Feb 12 23:18:23 2022 +0800

     🐛 🔥 🎨 fix: gif panic

commit aaf832e3b5
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 21:06:21 2022 +0800

    Update chat.go

commit fae3458bcf
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Sat Feb 12 13:05:37 2022 +0000

    🎨 改进代码样式

commit 610cae5229
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 21:05:08 2022 +0800

    Update chat.go

commit c445c61da5
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:58:57 2022 +0800

    Delete data.go

commit 70172f4d8b
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:53:10 2022 +0800

    换了个网易云音乐热评的API

commit c8b4827e91
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Sat Feb 12 12:50:57 2022 +0000

    🎨 改进代码样式

commit a233586dfe
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:50:21 2022 +0800

    Update chat.go

commit 87501f6011
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:49:08 2022 +0800

    Update data.go

commit ecf6419065
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:48:14 2022 +0800

    Update chat.go

commit c3550503f0
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:47:47 2022 +0800

    Delete plugin_purechat directory

commit 1da3486d00
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:46:34 2022 +0800

    Add files via upload

commit 34ed8c89fd
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:38:46 2022 +0800

    Update main.go

commit aa08eb0120
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:38:19 2022 +0800

    修改过的回复 删掉了一些ex的词汇

commit faf198289f
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:29:59 2022 +0800

    Update main.go

commit 5ac3b7a790
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:28:48 2022 +0800

    Update chat.go

commit b046d45435
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:25:23 2022 +0800

    Rename purechat.go to chat.go

commit 6bbcdfcd58
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:24:54 2022 +0800

    Add files via upload

commit e7630b5904
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:24:32 2022 +0800

    Update purechat.go

commit 36c903bece
Author: MoeMagicMango <i@himoyo.cn>
Date:   Sat Feb 12 20:23:01 2022 +0800

    Create purechat.go
2022-02-12 23:38:45 +08:00
MoeMagicMango
ed7bbf54a7 Update chat.go 2022-02-12 23:36:58 +08:00
fumiama
69394377d0 fix: emojimix logical error 2022-02-12 14:48:12 +08:00
fumiama
8f20487a15 Merge branch 'master' of https://github.com/FloatTech/ZeroBot-Plugin 2022-02-12 14:20:21 +08:00
fumiama
fae24db2df 💩👌 make lint happy 2022-02-12 14:20:10 +08:00
github-actions[bot]
f8fb791d8f 🎨 改进代码样式 2022-02-12 06:19:04 +00:00
Kanri
f320d9e1e5 增加插件 emojimix (#121)
*  增加插件 emojimix

* 🎨✏️ 优化代码格式

*  增加 qqface 支持

* Update main.go

Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
2022-02-12 14:18:05 +08:00
fumiama
18bd34fad2 fix(#122): 避免图片过大导致内存占用过多 2022-02-12 13:37:06 +08:00
fumiama
cf72d0b36a fix(#122): 避免图片过大导致内存占用过多 2022-02-12 13:32:26 +08:00
fumiama
c3722b0a6c ️ perf: 每次匹配仅检查一次 ban 2022-02-11 00:39:50 +08:00
fumiama
3af701e803 🎉 🎨 ️ 优化 base64 图片 log 体验 & 减少 ban 遍历 2022-02-10 23:47:39 +08:00
fumiama
bc4b2e89db 🎉 base14支持所有平台 2022-02-10 14:15:49 +08:00
fumiama
3cbb589d2c 💩👌 make lint happy 2022-02-09 21:00:42 +08:00
github-actions[bot]
63ef93a9f9 🎨 改进代码样式 2022-02-09 07:44:23 +00:00
fumiama
8c943d2c01 🔥 🎨 优化代码结构 2022-02-09 15:43:14 +08:00
84 changed files with 1207 additions and 643 deletions

View File

@@ -45,6 +45,7 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
## 功能
> 在编译时,以下功能除插件控制外,均可通过注释`main.go`中的相应`import`而物理禁用,减小插件体积。
> 通过插件控制,还可动态管理某个功能在某个群的打开/关闭。
> 插件的优先级为`import`的先后顺序
- **web管理** `import _ "github.com/FloatTech/zbputils/control/web"`
- 开启后可执行文件大约增加 5M ,默认注释不开启。如需开启请自行编辑`main.go`取消注释
- 需要配合 [webgui](https://github.com/FloatTech/bot-manager) 使用
@@ -71,7 +72,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] 空调关
- [x] 群温度
- [x] 设置温度[正整数]
- [x] @Bot mua | 啾咪 | 摸 | 上你 | 傻 | 裸 | 贴 | 老婆 | 抱 | 亲 | 一下 | 咬 | 操 | 123 | 进去 | 调教 | 搓 | 让 | 捏 | 挤 | 略 | 呐 | 原味 | 胖次 | 内裤 | 内衣 | 衣服 | ghs | 批 | 憨批 | kkp | 咕 | 骚 | 喜欢 | suki | 好き | 看 | 不能 | 砸了 | 透 | 口我 | 草我 | 自慰 | onani | オナニー | 炸了 | 色图 | 涩图 | 告白 | 对不起 | 回来 | 吻 | 软 | 壁咚 | 掰开 | 女友 | 是 | 喵 | 嗷呜 | 叫 | 拜 | 佬 | awsl | 臭 | 香 | 腿 | 张开 | 脚 | 脸 | 头发 | 手 | pr | 舔 | 小穴 | 腰 | 诶嘿嘿 | 可爱 | 扭蛋 | 鼻 | 眼 | 色气 | 推 | 床 | 举 | 手冲 | 饿 | 变 | 敲 | 爬 | 怕 | 冲 | 射 | 不穿 | 迫害 | 猫粮 | 揪尾巴 | 薄荷 | 早 | 晚安 | 揉 | 榨 | 掐 | 胸 | 奶子 | 欧派 | 嫩 | 蹭 | 牵手 | 握手 | 拍照 | w | 睡不着 | 欧尼酱 | 哥 | 爱你 | 过来 | 自闭 | 打不过 | 么么哒 | 很懂 | 膝枕 | 累了 | 安慰 | 洗澡 | 一起睡觉 | 一起 | 多大 | 姐姐 | 糖 | 嗦 | 牛子 | 🐂子 | 🐮子 | 嫌弃 | 紧 | baka | 笨蛋 | 插 | 插进来 | 屁股 | 翘 | 翘起来 | 抬 | 抬起 | 爸 | 傲娇 | rua | 咕噜咕噜 | 咕噜 | 上床 | 做爱 | 吃掉 | 吃 | 揪 | 种草莓 | 种草 | 掀 | 妹 | 病娇 | 嘻
- **词典匹配回复** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_thesaurus"`
- [x] @Bot 关键词
- **ATRI** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri"`
- [x] 具体指令看 /用法 atri
- 注:本插件基于 [ATRI](https://github.com/Kyomotoi/ATRI) ,为 Golang 移植版
@@ -135,8 +137,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] 用yyy加密xxx
- [x] 用yyy解密xxx
- **摸鱼** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_moyu"`
- [x] 添加摸鱼提醒
- [x] 删除摸鱼提醒
- [x] /启用 moyu
- [x] /禁用 moyu
- **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"`
- [x] 来份[涩图/二次元/风景/车万]
- [x] 添加[涩图/二次元/风景/车万][P站图片ID]
@@ -246,6 +248,8 @@ zerobot [-h] [-t token] [-u url] [-n nickname] [-p prefix] [-d|w] [-g 监听地
- [x] 讲个笑话[@xxx] | 讲个笑话[qq号]
- **抽象话** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chouxianghua"`
- [x] 抽象翻译[xxx]
- **合成emoji** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix"`
- [x] [emoji][emoji]
- **绝绝子** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_juejuezi"`
- [x] 喝奶茶绝绝子 | 绝绝子吃饭
- **藏头诗** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_cangtoushi"`

12
go.mod
View File

@@ -3,16 +3,16 @@ module github.com/FloatTech/ZeroBot-Plugin
go 1.17
require (
github.com/FloatTech/AnimeAPI v1.2.5
github.com/FloatTech/AnimeAPI v1.3.0-beta7
github.com/FloatTech/sqlite v0.1.0
github.com/FloatTech/zbputils v1.2.5
github.com/FloatTech/zbputils v1.3.0-beta7
github.com/antchfx/htmlquery v1.2.4
github.com/corona10/goimagehash v1.0.3
github.com/fogleman/gg v1.3.0
github.com/fumiama/cron v1.3.0
github.com/fumiama/go-base16384 v1.2.1
github.com/fumiama/go-registry v0.0.2
github.com/fumiama/gofastTEA v0.0.6
github.com/fumiama/go-base16384 v1.3.0
github.com/fumiama/go-registry v0.0.3
github.com/fumiama/gofastTEA v0.0.7
github.com/fumiama/gotracemoe v0.0.3
github.com/jinzhu/gorm v1.9.16
github.com/logoove/sqlite v1.13.0
@@ -20,7 +20,7 @@ require (
github.com/shirou/gopsutil/v3 v3.21.12
github.com/sirupsen/logrus v1.8.1
github.com/tidwall/gjson v1.13.0
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220208041536-d463c1c92bb4
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220210161326-bffb4cc61866
golang.org/x/image v0.0.0-20211028202545-6944b10bf410
)

36
go.sum
View File

@@ -1,12 +1,10 @@
github.com/FloatTech/AnimeAPI v1.2.5 h1:X0NLJSl9o63vRwGRPn/XiojOOBqZRbY94TxPEvhiVRo=
github.com/FloatTech/AnimeAPI v1.2.5/go.mod h1:nJpebBjTNUpr4cV0bR0Xu54/SP78+iN7hJ2EfQWbM7M=
github.com/FloatTech/AnimeAPI v1.3.0-beta7 h1:IdusxP4eFRk3ghU/+4CtAd5xPe0xGa6pK/k2CzlYORM=
github.com/FloatTech/AnimeAPI v1.3.0-beta7/go.mod h1:vqOt05nnc7vwEvAJfnRw37OLmrxoMCzLzDdCBLYknXg=
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
github.com/FloatTech/sqlite v0.1.0 h1:Geh6Z+DWZXmyXVOhM0U2oXT7b1Ob6sQtuyjInk+MCUk=
github.com/FloatTech/sqlite v0.1.0/go.mod h1:XS0oeSqtH6lFzpPRiDE9fV6+zMcuUF5/6o+tQVO1QZE=
github.com/FloatTech/zbputils v1.2.5 h1:/JyN6ear5PPpBjrjQEQT0/8mPBMJYBswLiNIzfmGYU8=
github.com/FloatTech/zbputils v1.2.5/go.mod h1:e9e8998yQkzS24IqZ8jLUssTk607hD/Tj3zGyBikIIc=
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb h1:Rkj28fqIwGx/EgBzRYtpmJRfH6wqVn7cNdc7aJ0QE4M=
github.com/Mrs4s/MiraiGo v0.0.0-20211120033824-43b23f4e6fcb/go.mod h1:imVKbfKqqeit+C/eaWGb4MKQ3z3gN6pRpBU5RMtp5so=
github.com/FloatTech/zbputils v1.3.0-beta7 h1:An+//viWflHwuG/1Z3NPbUjOO0XNsd60+b0c4vJm9I0=
github.com/FloatTech/zbputils v1.3.0-beta7/go.mod h1:P3tTFIIQJs/cijG80jwxrs0NBGISEDkXtrZhiev/eMk=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0=
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc/go.mod h1:OMmITAib6POA37xCichWM0aRnoVpSMZO1rB/G01wrr0=
@@ -36,12 +34,12 @@ github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzP
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo=
github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY=
github.com/fumiama/go-base16384 v1.2.1 h1:6OGprW8g/95m2ocmryHi8mipZ7bx9StFMZDKEqLvMiA=
github.com/fumiama/go-base16384 v1.2.1/go.mod h1:1HTC0QFL7BjS0DuO5Qm+fBYKQkHqmAapLbRpCxrhPXQ=
github.com/fumiama/go-registry v0.0.2 h1:2EoZwZpqI7YhkQ1FnuAPvALYPpvUtbsCqk879+r7ehs=
github.com/fumiama/go-registry v0.0.2/go.mod h1:QkcmmHuw1y6y/w7/HiH1c9yjBw5Zt+6EER6YJKl9xh8=
github.com/fumiama/gofastTEA v0.0.6 h1:Yni3MXDbJVa/c4CecgdZDgCJK+fLdvGph+OBqY2mtiI=
github.com/fumiama/gofastTEA v0.0.6/go.mod h1:+sBZ05nCA2skZkursHNvyr8kULlEetrYTM2y5kA4rQc=
github.com/fumiama/go-base16384 v1.3.0 h1:J5Xtwh/3alGJt/z/0IFralo5UQA89iFWQqbxj5ZQZi8=
github.com/fumiama/go-base16384 v1.3.0/go.mod h1:RGA715p34BiLoZvPRtaxuo2q25Kq9jFsgUsJb8dwy14=
github.com/fumiama/go-registry v0.0.3 h1:zdfRR3lrgrKobw/T2oh1+HbSbKyUZ6sBvgdh+teQNtk=
github.com/fumiama/go-registry v0.0.3/go.mod h1:tomy1EvenUPgxCPf/mFx0QZxp13ZO4hsSIslbkyeNQA=
github.com/fumiama/gofastTEA v0.0.7 h1:Dbce+22jNm+7jpmAeju0C+esIAAnIrq75f5TsCYprS8=
github.com/fumiama/gofastTEA v0.0.7/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk=
github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6/Jc=
github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
@@ -77,7 +75,6 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
@@ -89,7 +86,6 @@ github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
@@ -123,8 +119,6 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
@@ -148,14 +142,10 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
github.com/tidwall/gjson v1.11.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.13.0 h1:3TFY9yxOQShrvmjdM76K+jc66zJeT6D3/VFFYCGQf7M=
github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo=
@@ -166,10 +156,8 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM
github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
github.com/wdvxdr1123/ZeroBot v1.3.2/go.mod h1:i2DIqQjtjE+3gvVi9r9sc+QpNaUuyTXx/HNXXayIpwI=
github.com/wdvxdr1123/ZeroBot v1.4.1/go.mod h1:7t9m4vDZPwWAmzKlhP6IvUoisOIiqNdm/3AJgiY3+ew=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220208041536-d463c1c92bb4 h1:T/m7vDUFKdLd0xfSZHVPQGaRZ73nwPzidLW7hTn25mg=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220208041536-d463c1c92bb4/go.mod h1:NwXIp7PgjV+kUALMXJ4v4/3QcsRSOodtjhLekuPXFog=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220210161326-bffb4cc61866 h1:Llw9RtwVuX5quM4nAOgYpF9QHhgaTNk5AoCT0umYmas=
github.com/wdvxdr1123/ZeroBot v1.4.2-0.20220210161326-bffb4cc61866/go.mod h1:NwXIp7PgjV+kUALMXJ4v4/3QcsRSOodtjhLekuPXFog=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=

181
main.go
View File

@@ -6,89 +6,146 @@ import (
"os"
"strings"
// 注:以下插件均可通过前面加 // 注释,注释后停用并不加载插件
// 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用
// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
// ----------------------插件优先级按顺序从高到低---------------------- //
// //
// //
// //
// //
// //
// ----------------------------高优先级区---------------------------- //
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
// vvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvv //
// vvvvvvv高优先级区vvvvvvv //
// vvvvvvvvvvvvvv //
// vvvv //
// 插件控制
// webctrl "github.com/FloatTech/zbputils/control/web" // web 后端控制
// webctrl "github.com/FloatTech/zbputils/control/web" // web 后端控制
// 词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply" // 人工智能回复
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
// 实用类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_b14" // base16384加解密
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_github" // 搜索GitHub仓库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_manager" // 群管
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nbnhhsh" // 拼音首字母缩写释义工具
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode" // 在线运行代码
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage" // 统计睡眠时间
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_translation" // 翻译
// 娱乐类
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin_wtf" // 鬼东西
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_book_review" // 哀伤雪刃吧推书记录
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_cangtoushi" // 藏头诗
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose" // 选择困难症帮手
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chouxianghua" // 说抽象话
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_cpstory" // cp短打
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse" // 骂人
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny" // 笑话
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_gif" // 制图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_jandan" // 煎蛋网无聊图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_juejuezi" // 绝绝子生成器
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_moyu" // 摸鱼
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" // 铅笔小说网搜索
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn" // 投胎
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_score" // 分数
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao" // 沙雕app
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_wangyiyun" // 网易云音乐热评
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
// b站相关
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_manager" // 群管
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_thesaurus" // 词典匹配回复
// ^^^^ //
// ^^^^^^^^^^^^^^ //
// ^^^^^^^高优先级区^^^^^^^ //
// ^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^ //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// ----------------------------高优先级区---------------------------- //
// //
// //
// //
// //
// //
// ----------------------------中优先级区---------------------------- //
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
// vvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvv //
// vvvvvvv中优先级区vvvvvvv //
// vvvvvvvvvvvvvv //
// vvvv //
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage" // 随机图片与AI点评
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife" // 随机老婆
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_b14" // base16384加解密
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili" // 查询b站用户信息
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_parse" // b站视频链接解析
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_book_review" // 哀伤雪刃吧推书记录
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_cangtoushi" // 藏头诗
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_choose" // 选择困难症帮手
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chouxianghua" // 说抽象话
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_coser" // 三次元小姐姐
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_cpstory" // cp短打
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_danbooru" // DeepDanbooru二次元图标签识别
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana" // 嘉心糖发病
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_emojimix" // 合成emoji
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_fortune" // 运势
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_funny" // 笑话
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_gif" // 制图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_github" // 搜索GitHub仓库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_hs" // 炉石
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder" // 关键字搜图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_jandan" // 煎蛋网无聊图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_juejuezi" // 绝绝子生成器
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_moyu" // 摸鱼
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nativesetu" // 本地涩图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nativewife" // 本地老婆
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nbnhhsh" // 拼音首字母缩写释义工具
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_novel" // 铅笔小说网搜索
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nsfw" // nsfw图片识别
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_reborn" // 投胎
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode" // 在线运行代码
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_scale" // 叔叔的AI二次元图片放大
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_score" // 分数
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shadiao" // 沙雕app
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_tracemoe" // 搜番
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_translation" // 翻译
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation" // vtb语录
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_wangyiyun" // 网易云音乐热评
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_push" // b站推送
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana" // 嘉心糖发病
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin_wtf" // 鬼东西
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili_push" // b站推送
// 二次元图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage" // 随机图片与AI点评
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_aiwife" // 随机老婆
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_coser" // 三次元小姐姐
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_danbooru" // DeepDanbooru二次元图标签识别
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_image_finder" // 关键字搜图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_lolicon" // lolicon 随机图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nativesetu" // 本地涩图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nativewife" // 本地老婆
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_nsfw" // nsfw图片识别
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao" // 以图搜图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_scale" // 叔叔的AI二次元图片放大
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime" // 来份涩图
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_tracemoe" // 搜番
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation" // vtb语录
// ^^^^ //
// ^^^^^^^^^^^^^^ //
// ^^^^^^^中优先级区^^^^^^^ //
// ^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^ //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// ----------------------------中优先级区---------------------------- //
// //
// //
// //
// //
// //
// ----------------------------低优先级区---------------------------- //
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
// vvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvv //
// vvvvvvv低优先级区vvvvvvv //
// vvvvvvvvvvvvvv //
// vvvv //
// 以下为内置依赖,勿动
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_curse" // 骂人
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_reply" // 人工智能回复
// ^^^^ //
// ^^^^^^^^^^^^^^ //
// ^^^^^^^低优先级区^^^^^^^ //
// ^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^ //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// ----------------------------低优先级区---------------------------- //
// //
// //
// //
// //
// //
// -----------------------以下为内置依赖,勿动------------------------ //
"github.com/FloatTech/zbputils/control/order"
"github.com/fumiama/go-registry"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/driver"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
// -----------------------以上为内置依赖,勿动------------------------ //
)
var (
contents = []string{
"* OneBot + ZeroBot + Golang",
"* Version 1.2.5 - 2022-01-30 20:06:00 +0800 CST",
"* Version 1.3.0 - 2022-02-09 14:31:34 +0800 CST",
"* Copyright © 2020 - 2021 FloatTech. All Rights Reserved.",
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}

View File

@@ -1,14 +0,0 @@
package order
import "sync"
var wg sync.WaitGroup
// DoneOnExit 在退出时执行 Done
func DoneOnExit() func() {
wg.Add(1)
return wg.Done
}
// Wait 等待
var Wait = wg.Wait

View File

@@ -1,62 +0,0 @@
// Package order 各个插件的优先级
package order
const (
PrioChat = iota * 10
PrioSleepManage
PrioAtri
PrioManager
PrioACGImage
PrioAIFalse
PrioAIWife
PrioBase14
PrioBilibili
PrioBiliBiliParse
PrioBilibiliPush
PrioBookReview
PrioCangTouShi
PrioChoose
PrioChouXiangHua
PrioCoser
PrioCPStory
PrioDanbooru
PrioDiana
PrioFansDaily
PrioFortune
PrioFunny
PrioGIF
PrioGithub
PrioHS
PrioImageFinder
PrioJandan
PrioJueJueZi
PrioLolicon
PrioMinecraft
PrioMoyu
PrioMusic
PrioNativeSetu
PrioNativeWife
PrioNBNHHSH
PrioNovel
PrioNSFW
PrioNSFWAuto
PrioOmikuji
PrioReborn
PrioRuncode
PrioSauceNao
PrioScale
PrioScore
PrioSetuTime
PrioShaDiao
PrioShinDan
PrioTraceMoe
PrioTranslation
PrioVtbQuotation
PrioWangYiYun
PrioWtf
PrioCurse
PrioMockingBird
PrioAIReply
)

View File

@@ -8,12 +8,12 @@ import (
"github.com/FloatTech/AnimeAPI/classify"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/imgpool"
"github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/web"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -30,7 +30,7 @@ var (
)
func init() { // 插件主体
engine := control.Register("acgimage", order.PrioACGImage, &control.Options{
engine := control.Register("acgimage", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "随机图片与AI点评\n" +
"- 随机图片(评级大于6的图将私发)\n" +
@@ -82,7 +82,7 @@ func init() { // 插件主体
}
})
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
engine.OnKeywordGroup([]string{"评价图片"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
for _, url := range ctx.State["image_url"].([]string) {
@@ -102,7 +102,7 @@ func init() { // 插件主体
u = apihead + dhash
}
m, hassent, err := imgpool.NewImage(ctxext.Send(ctx), ctxext.GetMessage(ctx), dhash, u)
m, hassent, err := pool.NewImage(ctxext.Send(ctx), ctxext.GetMessage(ctx), dhash, u)
if err == nil && !hassent {
ctx.SendChain(message.Image(m.String()))
}
@@ -146,7 +146,7 @@ func replyClass(ctx *zero.Ctx, class int, dhash string, comment string, isupload
}
}
m, hassent, err := imgpool.NewImage(send, ctxext.GetMessage(ctx), b14, u)
m, hassent, err := pool.NewImage(send, ctxext.GetMessage(ctx), b14, u)
if err == nil && !hassent {
send(message.Message{message.Image(m.String())})
}

View File

@@ -12,14 +12,14 @@ import (
"github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/mem"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
func init() { // 插件主体
engine := control.Register("aifalse", order.PrioAIFalse, &control.Options{
engine := control.Register("aifalse", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "AIfalse\n" +
"- 查询计算机当前活跃度: [检查身体 | 自检 | 启动自检 | 系统状态]",

View File

@@ -11,7 +11,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -21,7 +21,7 @@ const (
var modes = [...]string{"青云客", "小爱"}
func init() { // 插件主体
engine := control.Register(serviceName, order.PrioAIReply, &control.Options{
engine := control.Register(serviceName, order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "人工智能回复\n" +
"- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客 | 小爱]\n- ",

View File

@@ -5,22 +5,22 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/AnimeAPI/aireply"
"github.com/FloatTech/AnimeAPI/mockingbird"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/AnimeAPI/tts/mockingbird"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
control.Register("mockingbird", order.PrioMockingBird, &control.Options{
control.Register("mockingbird", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "拟声鸟\n- @Bot 任意文本(任意一句话回复)",
}).OnMessage(zero.OnlyToMe).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
msg := ctx.ExtractPlainText()
r := aireply.NewAIReply(getReplyMode(ctx))
ctx.SendChain(message.Record(mockingbird.Speak(ctx.Event.UserID, func() string {
ctx.SendChain(message.Record(mockingbird.NewMockingBirdTTS(1).Speak(ctx.Event.UserID, func() string {
return r.TalkPlain(msg, zero.BotConfig.NickName[0])
})))
})

View File

@@ -11,7 +11,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -20,7 +20,7 @@ const (
func init() { // 插件主体
rand.Seed(time.Now().UnixNano())
control.Register("aiwife", order.PrioAIWife, &control.Options{
control.Register("aiwife", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "AIWife\n" +
"- waifu | 随机waifu",

View File

@@ -15,7 +15,7 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -26,7 +26,7 @@ const (
)
func init() { // 插件主体
engine := control.Register(servicename, order.PrioAtri, &control.Options{
engine := control.Register(servicename, order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "本插件基于 ATRI ,为 Golang 移植版\n" +
"- ATRI醒醒\n- ATRI睡吧\n- 萝卜子\n- 喜欢 | 爱你 | 爱 | suki | daisuki | すき | 好き | 贴贴 | 老婆 | 亲一个 | mua\n" +

View File

@@ -11,11 +11,11 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
en := control.Register("base16384", order.PrioBase14, &control.Options{
en := control.Register("base16384", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "base16384加解密\n" +
"- 加密xxx\n- 解密xxx\n- 用yyy加密xxx\n- 用yyy解密xxx",

View File

@@ -10,7 +10,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
type follower struct {
@@ -27,7 +27,7 @@ type follower struct {
// 开启日报推送
func init() {
fansDaily()
en := control.Register("fansdaily", order.PrioFansDaily, &control.Options{
en := control.Register("fansdaily", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "fansdaily\n- /开启粉丝日报\n- /关闭粉丝日报",
})

View File

@@ -10,10 +10,10 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var engine = control.Register("bilibili", order.PrioBilibili, &control.Options{
var engine = control.Register("bilibili", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "bilibili\n" +
"- >vup info [名字 | uid]\n" +

View File

@@ -11,7 +11,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
@@ -20,7 +20,7 @@ var (
)
func init() {
engine := control.Register("bilibiliparse", order.PrioBiliBiliParse, &control.Options{
engine := control.Register("bilibiliparse", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "b站视频链接解析\n" +
"- https://www.bilibili.com/video/BV1xx411c7BF | https://www.bilibili.com/video/av1605 | https://b23.tv/I8uzWCA",

View File

@@ -20,7 +20,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -57,7 +57,7 @@ var (
func init() {
go bilibiliPushDaily()
en := control.Register(serviceName, order.PrioBilibiliPush, &control.Options{
en := control.Register(serviceName, order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "bilibilipush\n" +
"- 添加订阅[uid]\n" +

View File

@@ -6,7 +6,7 @@ import (
"github.com/FloatTech/zbputils/process"
log "github.com/sirupsen/logrus"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -10,11 +10,11 @@ import (
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
engine := control.Register("bookreview", order.PrioBookReview, &control.Options{
engine := control.Register("bookreview", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "哀伤雪刃推书记录\n- 书评[xxx]\n- 随机书评",
})

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const dbpath = "data/BookReview/"

View File

@@ -16,7 +16,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -32,7 +32,7 @@ var (
)
func init() {
engine := control.Register("cangtoushi", order.PrioCangTouShi, &control.Options{
engine := control.Register("cangtoushi", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "藏头诗\n" +
"- 藏头诗[xxx]\n- 藏尾诗[xxx]",

View File

@@ -11,27 +11,20 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
)
const (
dbpath = "data/Chat/"
dbfile = dbpath + "kimoi.json"
"github.com/FloatTech/zbputils/control/order"
)
var (
poke = rate.NewManager(time.Minute*5, 8) // 戳一戳
engine = control.Register("chat", order.PrioChat, &control.Options{
engine = control.Register("chat", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "chat\n- [BOT名字]\n- [戳一戳BOT]\n- 空调开\n- 空调关\n- 群温度\n- 设置温度[正整数]\n- mua | 啾咪 | 摸 | 上你 | 傻 | 裸 | 贴 | 老婆 | 抱 | 亲 | 一下 | 咬 | 操 | 123 | 进去 | 调教 | 搓 | 让 | 捏 | 挤 | 略 | 呐 | 原味 | 胖次 | 内裤 | 内衣 | 衣服 | ghs | 批 | 憨批 | kkp | 咕 | 骚 | 喜欢 | suki | 好き | 看 | 不能 | 砸了 | 透 | 口我 | 草我 | 自慰 | onani | オナニー | 炸了 | 色图 | 涩图 | 告白 | 对不起 | 回来 | 吻 | 软 | 壁咚 | 掰开 | 女友 | 是 | 喵 | 嗷呜 | 叫 | 拜 | 佬 | awsl | 臭 | 香 | 腿 | 张开 | 脚 | 脸 | 头发 | 手 | pr | 舔 | 小穴 | 腰 | 诶嘿嘿 | 可爱 | 扭蛋 | 鼻 | 眼 | 色气 | 推 | 床 | 举 | 手冲 | 饿 | 变 | 敲 | 爬 | 怕 | 冲 | 射 | 不穿 | 迫害 | 猫粮 | 揪尾巴 | 薄荷 | 早 | 晚安 | 揉 | 榨 | 掐 | 胸 | 奶子 | 欧派 | 嫩 | 蹭 | 牵手 | 握手 | 拍照 | w | 睡不着 | 欧尼酱 | 哥 | 爱你 | 过来 | 自闭 | 打不过 | 么么哒 | 很懂 | 膝枕 | 累了 | 安慰 | 洗澡 | 一起睡觉 | 一起 | 多大 | 姐姐 | 糖 | 嗦 | 牛子 | 🐂子 | 🐮子 | 嫌弃 | 紧 | baka | 笨蛋 | 插 | 插进来 | 屁股 | 翘 | 翘起来 | 抬 | 抬起 | 爸 | 傲娇 | rua | 咕噜咕噜 | 咕噜 | 上床 | 做爱 | 吃掉 | 吃 | 揪 | 种草莓 | 种草 | 掀 | 妹 | 病娇 | 嘻",
Help: "chat\n- [BOT名字]\n- [戳一戳BOT]\n- 空调开\n- 空调关\n- 群温度\n- 设置温度[正整数]",
})
kimomap = make(kimo, 256)
chatList = make([]string, 0, 256)
)
func init() { // 插件主体
// 被喊名字
engine.OnFullMatch("", zero.OnlyToMe).SetBlock(true).
engine.OnMessage(zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var nickname = zero.BotConfig.NickName[0]
time.Sleep(time.Second * 1)
@@ -111,13 +104,4 @@ func init() { // 插件主体
))
}
})
initChatList(func() {
engine.OnFullMatchGroup(chatList, zero.OnlyToMe).SetBlock(true).Handle(
func(ctx *zero.Ctx) {
key := ctx.MessageString()
val := *kimomap[key]
text := val[rand.Intn(len(val))]
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text))
})
})
}

View File

@@ -10,11 +10,11 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
engine := control.Register("choose", order.PrioChoose, &control.Options{
engine := control.Register("choose", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "choose\n" +
"- 选择可口可乐还是百事可乐\n" +

View File

@@ -6,11 +6,11 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
control.Register("chouxianghua", order.PrioChouXiangHua, &control.Options{
control.Register("chouxianghua", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "抽象话\n- 抽象翻译xxx",
}).OnRegex("^抽象翻译((\\s|[\\r\\n]|[\\p{Han}\\p{P}A-Za-z0-9])+)$").SetBlock(true).

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -13,7 +13,7 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
@@ -22,7 +22,7 @@ var (
)
func init() {
control.Register("coser", order.PrioCoser, &control.Options{
control.Register("coser", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "三次元小姐姐\n- coser",
}).ApplySingle(ctxext.DefaultSingle).OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup).

View File

@@ -11,11 +11,11 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
engine := control.Register("cpstory", order.PrioCPStory, &control.Options{
engine := control.Register("cpstory", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "cp短打\n- 组cp[@xxx][@xxx]\n- 磕cp大老师 雪乃",
})

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -18,7 +18,7 @@ const (
)
func init() {
engine := control.Register("curse", order.PrioCurse, &control.Options{
engine := control.Register("curse", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "骂人(求骂,自卫)\n- 骂我\n- 大力骂我",
})

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -16,7 +16,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const cachefile = "data/danbooru/"
@@ -27,13 +27,13 @@ func init() { // 插件主体
if err != nil {
panic(err)
}
engine := control.Register("danbooru", order.PrioDanbooru, &control.Options{
engine := control.Register("danbooru", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "二次元图片标签识别\n" +
"- 鉴赏图片[图片]",
})
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
engine.OnKeywordGroup([]string{"鉴赏图片"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中..."))
for _, url := range ctx.State["image_url"].([]string) {

View File

@@ -10,11 +10,12 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_diana/data"
)
var engine = control.Register("diana", order.PrioDiana, &control.Options{
var engine = control.Register("diana", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "嘉然\n" +
"- 小作文\n" +

View File

@@ -13,7 +13,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

249
plugin_emojimix/emoji.go Normal file
View File

@@ -0,0 +1,249 @@
// Package emojimix 合成emoji
package emojimix
var emojis = map[rune]int64{
128516: 20201001, // 😄 grinning face with smiling eyes
128512: 20201001, // 😀 grinning face
128578: 20201001, // 🙂 slightly smiling face
128579: 20201001, // 🙃 upside-down face
128521: 20201001, // 😉 winking face
128522: 20201001, // 😊 smiling face with smiling eyes
128518: 20201001, // 😆 grinning squinting face
128515: 20201001, // 😃 grinning face with big eyes
128513: 20201001, // 😁 beaming face with smiling eyes
129315: 20201001, // 🤣 rolling on the floor laughing
128517: 20201001, // 😅 grinning face with sweat
128514: 20201001, // 😂 face with tears of joy
128519: 20201001, // 😇 smiling face with halo
129392: 20201001, // 🥰 smiling face with hearts
128525: 20201001, // 😍 smiling face with heart-eyes
128536: 20201001, // 😘 face blowing a kiss
129321: 20201001, // 🤩 star-struck
128535: 20201001, // 😗 kissing face
128538: 20201001, // 😚 kissing face with closed eyes
128537: 20201001, // 😙 kissing face with smiling eyes
128539: 20201001, // 😛 face with tongue
128541: 20201001, // 😝 squinting face with tongue
128523: 20201001, // 😋 face savoring food
129394: 20201001, // 🥲 smiling face with tear
129297: 20201001, // 🤑 money-mouth face
128540: 20201001, // 😜 winking face with tongue
129303: 20201001, // 🤗 smiling face with open hands hugs
129323: 20201001, // 🤫 shushing face quiet whisper
129300: 20201001, // 🤔 thinking face question hmmm
129325: 20201001, // 🤭 face with hand over mouth embarrassed
129320: 20201001, // 🤨 face with raised eyebrow question
129296: 20201001, // 🤐 zipper-mouth face
128528: 20201001, // 😐 neutral face
128529: 20201001, // 😑 expressionless face
128566: 20201001, // 😶 face without mouth
129322: 20201001, // 🤪 zany face
128527: 20201001, // 😏 smirking face suspicious
128530: 20201001, // 😒 unamused face
128580: 20201001, // 🙄 face with rolling eyes
128556: 20201001, // 😬 grimacing face
128558: 20210218, // 😮 face exhaling
129317: 20201001, // 🤥 lying face
128524: 20201001, // 😌 relieved face
128532: 20201001, // 😔 pensive face
128554: 20201001, // 😪 sleepy face
129316: 20201001, // 🤤 drooling face
128564: 20201001, // 😴 sleeping face
128567: 20201001, // 😷 face with medical mask
129298: 20201001, // 🤒 face with thermometer
129301: 20201001, // 🤕 face with head-bandage
129314: 20201001, // 🤢 nauseated face
129326: 20201001, // 🤮 face vomiting throw
129319: 20201001, // 🤧 sneezing face
129397: 20201001, // 🥵 hot face warm
129398: 20201001, // 🥶 cold face freezing ice
128565: 20201001, // 😵 face with crossed-out eyes
129396: 20201001, // 🥴 woozy face drunk tipsy drug high
129327: 20201001, // 🤯 exploding head mindblow
129312: 20201001, // 🤠 cowboy hat face
129395: 20201001, // 🥳 partying face
129400: 20201001, // 🥸 disguised face
129488: 20201001, // 🧐 face with monocle glasses
128526: 20201001, // 😎 smiling face with sunglasses
128533: 20201001, // 😕 confused face
128543: 20201001, // 😟 worried face
128577: 20201001, // 🙁 slightly frowning face
128559: 20201001, // 😯 hushed face
128562: 20201001, // 😲 astonished face
129299: 20201001, // 🤓 nerd face glasses
128563: 20201001, // 😳 flushed face
129402: 20201001, // 🥺 pleading face
128551: 20201001, // 😧 anguished face
128552: 20201001, // 😨 fearful face
128550: 20201001, // 😦 frowning face with open mouth
128560: 20201001, // 😰 anxious face with sweat
128549: 20201001, // 😥 sad but relieved face
128557: 20201001, // 😭 loudly crying face
128553: 20201001, // 😩 weary face
128546: 20201001, // 😢 crying face
128547: 20201001, // 😣 persevering face
128544: 20201001, // 😠 angry face
128531: 20201001, // 😓 downcast face with sweat
128534: 20201001, // 😖 confounded face
129324: 20201001, // 🤬 face with symbols on mouth
128542: 20201001, // 😞 disappointed face
128555: 20201001, // 😫 tired face
128548: 20201001, // 😤 face with steam from nose
129393: 20201001, // 🥱 yawning face
128169: 20201001, // 💩 pile of poo
128545: 20201001, // 😡 pouting face
128561: 20201001, // 😱 face screaming in fear
128127: 20201001, // 👿 angry face with horns
128128: 20201001, // 💀 skull
128125: 20201001, // 👽 alien
128520: 20201001, // 😈 smiling face with horns devil
129313: 20201001, // 🤡 clown face
128123: 20201001, // 👻 ghost
129302: 20201001, // 🤖 robot
128175: 20201001, // 💯 hundred points percent
128064: 20201001, // 👀 eyes
127801: 20201001, // 🌹 rose flower
127804: 20201001, // 🌼 blossom flower
127799: 20201001, // 🌷 tulip flower
127797: 20201001, // 🌵 cactus
127821: 20201001, // 🍍 pineapple
127874: 20201001, // 🎂 birthday cake
127751: 20210831, // 🌇 sunset
129473: 20201001, // 🧁 cupcake muffin
127911: 20210521, // 🎧 headphone earphone
127800: 20210218, // 🌸 cherry blossom flower
129440: 20201001, // 🦠 microbe germ bacteria virus covid corona
128144: 20201001, // 💐 bouquet flowers
127789: 20201001, // 🌭 hot dog food
128139: 20201001, // 💋 kiss mark lips
127875: 20201001, // 🎃 jack-o-lantern pumpkin
129472: 20201001, // 🧀 cheese wedge
9749: 20201001, // ☕ hot beverage coffee cup tea
127882: 20201001, // 🎊 confetti ball
127880: 20201001, // 🎈 balloon
9924: 20201001, // ⛄ snowman without snow
128142: 20201001, // 💎 gem stone crystal diamond
127794: 20201001, // 🌲 evergreen tree
129410: 20210218, // 🦂 scorpion
128584: 20201001, // 🙈 see-no-evil monkey
128148: 20201001, // 💔 broken heart
128140: 20201001, // 💌 love letter heart
128152: 20201001, // 💘 heart with arrow
128159: 20201001, // 💟 heart decoration
128158: 20201001, // 💞 revolving hearts
128147: 20201001, // 💓 beating heart
128149: 20201001, // 💕 two hearts
128151: 20201001, // 💗 growing heart
129505: 20201001, // 🧡 orange heart
128155: 20201001, // 💛 yellow heart
10084: 20210218, // ❤ mending heart
128156: 20201001, // 💜 purple heart
128154: 20201001, // 💚 green heart
128153: 20201001, // 💙 blue heart
129294: 20201001, // 🤎 brown heart
129293: 20201001, // 🤍 white heart
128420: 20201001, // 🖤 black heart
128150: 20201001, // 💖 sparkling heart
128157: 20201001, // 💝 heart with ribbon
127873: 20211115, // 🎁 wrapped-gift
129717: 20211115, // 🪵 wood
127942: 20211115, // 🏆 trophy
127838: 20210831, // 🍞 bread
128240: 20201001, // 📰 newspaper
128302: 20201001, // 🔮 crystal ball
128081: 20201001, // 👑 crown
128055: 20201001, // 🐷 pig face
129412: 20210831, // 🦄 unicorn
127771: 20201001, // 🌛 first quarter moon face
129420: 20201001, // 🦌 deer
129668: 20210521, // 🪄 magic wand
128171: 20201001, // 💫 dizzy
128049: 20201001, // 🐱 meow cat face
129409: 20201001, // 🦁 lion
128293: 20201001, // 🔥 fire
128038: 20210831, // 🐦 bird
129415: 20201001, // 🦇 bat
129417: 20210831, // 🦉 owl
127752: 20201001, // 🌈 rainbow
128053: 20201001, // 🐵 monkey face
128029: 20201001, // 🐝 honeybee bumblebee wasp
128034: 20201001, // 🐢 turtle
128025: 20201001, // 🐙 octopus
129433: 20201001, // 🦙 llama alpaca
128016: 20210831, // 🐐 goat
128060: 20201001, // 🐼 panda
128040: 20201001, // 🐨 koala
129445: 20201001, // 🦥 sloth
128059: 20210831, // 🐻 bear
128048: 20201001, // 🐰 rabbit face
129428: 20201001, // 🦔 hedgehog
128054: 20211115, // 🐶 dog puppy
128041: 20211115, // 🐩 poodle dog
129437: 20211115, // 🦝 raccoon
128039: 20211115, // 🐧 penguin
128012: 20210218, // 🐌 snail
128045: 20201001, // 🐭 mouse face rat
128031: 20210831, // 🐟 fish
127757: 20201001, // 🌍 globe showing Europe-Africa
127774: 20201001, // 🌞 sun with face
127775: 20201001, // 🌟 glowing star
11088: 20201001, // ⭐ star
127772: 20201001, // 🌜 last quarter moon face
129361: 20201001, // 🥑 avocado
127820: 20211115, // 🍌 banana
127827: 20210831, // 🍓 strawberry
127819: 20210521, // 🍋 lemon
127818: 20211115, // 🍊 tangerine orange
}
var qqface = map[int]rune{
0: 128558, // 😮 face exhaling
1: 128556, // 😬 grimacing face
2: 128525, // 😍 smiling face with heart-eyes
4: 128526, // 😎 smiling face with sunglasses
5: 128557, // 😭 loudly crying face
6: 129402, // 🥺 pleading face
7: 129296, // 🤐 zipper-mouth face
8: 128554, // 😪 sleepy face
11: 128545, // 😡 pouting face
12: 128539, // 😛 face with tongue
13: 128513, // 😁 beaming face with smiling eyes
14: 128578, // 🙂 slightly smiling face
15: 128577, // 🙁 slightly frowning face
16: 128526, // 😎 smiling face with sunglasses
19: 129326, // 🤮 face vomiting throw
20: 129325, // 🤭 face with hand over mouth embarrassed
21: 128522, // 😊 smiling face with smiling eyes
23: 128533, // 😕 confused face
24: 128523, // 😋 face savoring food
27: 128531, // 😓 downcast face with sweat
28: 128516, // 😄 grinning face with smiling eyes
31: 129324, // 🤬 face with symbols on mouth
32: 129300, // 🤔 thinking face question hmmm
33: 129323, // 🤫 shushing face quiet whisper
34: 128565, // 😵 face with crossed-out eyes
35: 128547, // 😣 persevering face
37: 128128, // 💀 skull
46: 128055, // 🐷 pig face
53: 127874, // 🎂 birthday cake
59: 128169, // 💩 pile of poo
60: 9749, // ☕ hot beverage coffee cup tea
63: 127801, // 🌹 rose flower
66: 10084, // ❤ mending heart
67: 128148, // 💔 broken heart
69: 127873, // 🎁 wrapped-gift
74: 127774, // 🌞 sun with face
75: 127772, // 🌜 last quarter moon face
96: 128517, // 😅 grinning face with sweat
104: 129393, // 🥱 yawning face
109: 128535, // 😗 kissing face
110: 128562, // 😲 astonished face
111: 129402, // 🥺 pleading face
172: 128539, // 😛 face with tongue
182: 128514, // 😂 face with tears of joy
187: 128123, // 👻 ghost
247: 128567, // 😷 face with medical mask
272: 128579, // 🙃 upside-down face
320: 129395, // 🥳 partying face
325: 128561, // 😱 face screaming in fear
}

101
plugin_emojimix/mix.go Normal file
View File

@@ -0,0 +1,101 @@
// Package emojimix 合成emoji
package emojimix
import (
"fmt"
"net/http"
"strconv"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/zbputils/ctxext"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
)
const bed = "https://www.gstatic.com/android/keyboard/emojikitchen/%d/u%x/u%x_u%x.png"
func init() {
control.Register("emojimix", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "合成emoji\n" +
"- [emoji][emoji]",
}).OnMessage(match).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
r := ctx.State["emojimix"].([]rune)
logrus.Debugln("[emojimix] match:", r)
r1, r2 := r[0], r[1]
u1 := fmt.Sprintf(bed, emojis[r1], r1, r1, r2)
u2 := fmt.Sprintf(bed, emojis[r2], r2, r2, r1)
logrus.Debugln("[emojimix] u1:", u1)
logrus.Debugln("[emojimix] u2:", u2)
resp1, err := http.Head(u1)
if err == nil {
resp1.Body.Close()
if resp1.StatusCode == http.StatusOK {
ctx.SendChain(message.Image(u1))
return
}
}
resp2, err := http.Head(u2)
if err == nil {
resp2.Body.Close()
if resp2.StatusCode == http.StatusOK {
ctx.SendChain(message.Image(u2))
return
}
}
})
}
func match(ctx *zero.Ctx) bool {
logrus.Debugln("[emojimix] msg:", ctx.Event.Message)
if len(ctx.Event.Message) == 2 {
r1 := face2emoji(ctx.Event.Message[0])
if _, ok := emojis[r1]; !ok {
return false
}
r2 := face2emoji(ctx.Event.Message[1])
if _, ok := emojis[r2]; !ok {
return false
}
ctx.State["emojimix"] = []rune{r1, r2}
return true
}
r := []rune(ctx.Event.RawMessage)
logrus.Debugln("[emojimix] raw msg:", ctx.Event.RawMessage)
if len(r) == 2 {
if _, ok := emojis[r[0]]; !ok {
return false
}
if _, ok := emojis[r[1]]; !ok {
return false
}
ctx.State["emojimix"] = r
return true
}
return false
}
func face2emoji(face message.MessageSegment) rune {
if face.Type == "text" {
r := []rune(face.Data["text"])
if len(r) != 1 {
return 0
}
return r[0]
}
if face.Type != "face" {
return 0
}
id, err := strconv.Atoi(face.Data["id"])
if err != nil {
return 0
}
if r, ok := qqface[id]; ok {
return r
}
return 0
}

View File

@@ -22,11 +22,11 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/img/writer"
"github.com/FloatTech/zbputils/imgpool"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -76,7 +76,7 @@ func init() {
panic(err)
}
// 插件主体
en := control.Register("fortune", order.PrioFortune, &control.Options{
en := control.Register("fortune", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "每日运势: \n" +
"- 运势 | 抽签\n" +
@@ -147,7 +147,7 @@ func init() {
digest := md5.Sum(helper.StringToBytes(zipfile + strconv.Itoa(index) + title + text))
cachefile := cache + hex.EncodeToString(digest[:])
m, err := imgpool.GetImage(cachefile)
m, err := pool.GetImage(cachefile)
if err != nil {
logrus.Debugln("[fortune]", err)
if file.IsNotExist(cachefile) {

View File

@@ -8,7 +8,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
type joke struct {

View File

@@ -11,20 +11,17 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
engine = control.Register("funny", order.PrioFunny, &control.Options{
var db = &sql.Sqlite{DBPath: dbfile}
func init() {
control.Register("funny", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "讲个笑话\n" +
"- 讲个笑话[@xxx] | 讲个笑话[qq号]",
})
db = &sql.Sqlite{DBPath: dbfile}
)
func init() {
engine.OnPrefix("讲个笑话").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
}).OnPrefix("讲个笑话").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
// 获取名字
name := ctxext.NickName(ctx)
var j joke

View File

@@ -3,8 +3,10 @@ package gif
import (
"os"
"strconv"
"sync"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img"
"github.com/sirupsen/logrus"
)
@@ -13,36 +15,51 @@ type context struct {
headimgsdir []string
}
func dlchan(name string, c *chan *string) {
func dlchan(name string, s *string, wg *sync.WaitGroup, exit func(error)) {
defer wg.Done()
target := datapath + `materials/` + name
var err error
if file.IsNotExist(target) {
_ = file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
err = file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
if err != nil {
exit(err)
return
}
logrus.Debugln("[gif] dl", name, "to", target, "succeeded")
} else {
logrus.Debugln("[gif] dl", name, "exists")
logrus.Debugln("[gif] dl", name, "exists at", target)
}
*c <- &target
*s = target
}
func dlblock(name string) string {
func dlblock(name string) (string, error) {
target := datapath + `materials/` + name
if file.IsNotExist(target) {
_ = file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
err := file.DownloadTo(`https://codechina.csdn.net/u011570312/imagematerials/-/raw/main/`+name, target, true)
if err != nil {
return "", err
}
logrus.Debugln("[gif] dl", name, "to", target, "succeeded")
} else {
logrus.Debugln("[gif] dl", name, "exists")
logrus.Debugln("[gif] dl", name, "exists at", target)
}
return target
return target, nil
}
func dlrange(prefix string, end int) *[]chan *string {
func dlrange(prefix string, end int, wg *sync.WaitGroup, exit func(error)) []string {
if file.IsNotExist(datapath + `materials/` + prefix) {
_ = os.MkdirAll(datapath+`materials/`+prefix, 0755)
err := os.MkdirAll(datapath+`materials/`+prefix, 0755)
if err != nil {
exit(err)
return nil
}
}
c := make([]chan *string, end)
c := make([]string, end)
for i := range c {
c[i] = make(chan *string)
go dlchan(prefix+"/"+strconv.Itoa(i)+".png", &c[i])
wg.Add(1)
go dlchan(prefix+"/"+strconv.Itoa(i)+".png", &c[i], wg, exit)
}
return &c
return c
}
// 新的上下文
@@ -55,3 +72,14 @@ func newContext(user int64) *context {
c.headimgsdir[1] = c.usrdir + "1.gif"
return c
}
func LoadFirstFrames(paths []string, size int) (imgs []*img.ImgFactory, err error) {
imgs = make([]*img.ImgFactory, size)
for i := range imgs {
imgs[i], err = img.LoadFirstFrame(paths[i], 0, 0)
if err != nil {
return nil, err
}
}
return imgs, nil
}

View File

@@ -2,160 +2,344 @@ package gif
import (
"image"
"sync"
"github.com/FloatTech/zbputils/img"
"github.com/FloatTech/zbputils/img/writer"
)
// 摸
func (cc *context) mo() string {
// A
func (cc *context) A摸() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "摸.gif"
c := dlrange("mo", 5)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
mo := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 80, 80, 32, 32).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertBottom(tou, 70, 90, 42, 22).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertBottom(tou, 75, 85, 37, 27).Im,
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertBottom(tou, 85, 75, 27, 37).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertBottom(tou, 90, 70, 22, 42).Im,
c := dlrange("mo", 5, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
_ = writer.SaveGIF2Path(name, img.MergeGif(1, mo))
return "file:///" + name
tou, err := cc.getLogo(0, 0)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 5)
if err != nil {
return "", err
}
mo := []*image.NRGBA{
imgs[0].InsertBottom(tou, 80, 80, 32, 32).Im,
imgs[1].InsertBottom(tou, 70, 90, 42, 22).Im,
imgs[2].InsertBottom(tou, 75, 85, 37, 27).Im,
imgs[3].InsertBottom(tou, 85, 75, 27, 37).Im,
imgs[4].InsertBottom(tou, 90, 70, 22, 42).Im,
}
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(1, mo))
}
// 搓
func (cc *context) cuo() string {
// A
func (cc *context) A搓() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "搓.gif"
c := dlrange("cuo", 5)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 110, 110).Circle(0).Im
c := dlrange("cuo", 5, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(110, 110)
if err != nil {
return "", err
}
m1 := img.Rotate(tou, 72, 0, 0)
m2 := img.Rotate(tou, 144, 0, 0)
m3 := img.Rotate(tou, 216, 0, 0)
m4 := img.Rotate(tou, 288, 0, 0)
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 5)
if err != nil {
return "", err
}
cuo := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottomC(tou, 0, 0, 75, 130).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertBottomC(m1.Im, 0, 0, 75, 130).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertBottomC(m2.Im, 0, 0, 75, 130).Im,
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertBottomC(m3.Im, 0, 0, 75, 130).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertBottomC(m4.Im, 0, 0, 75, 130).Im,
imgs[0].InsertBottomC(tou, 0, 0, 75, 130).Im,
imgs[1].InsertBottomC(m1.Im, 0, 0, 75, 130).Im,
imgs[2].InsertBottomC(m2.Im, 0, 0, 75, 130).Im,
imgs[3].InsertBottomC(m3.Im, 0, 0, 75, 130).Im,
imgs[4].InsertBottomC(m4.Im, 0, 0, 75, 130).Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(5, cuo))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(5, cuo))
}
// 敲
func (cc *context) qiao() string {
// A
func (cc *context) A敲() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "敲.gif"
c := dlrange("qiao", 2)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 40, 40).Circle(0).Im
c := dlrange("qiao", 2, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(40, 40)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 2)
if err != nil {
return "", err
}
qiao := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 40, 33, 57, 52).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 38, 36, 58, 50).Im,
imgs[0].InsertUp(tou, 40, 33, 57, 52).Im,
imgs[1].InsertUp(tou, 38, 36, 58, 50).Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(1, qiao))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(1, qiao))
}
// 吃
func (cc *context) chi() string {
// A
func (cc *context) A吃() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "吃.gif"
c := dlrange("chi", 3)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 32, 32).Im
c := dlrange("chi", 3, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(32, 32)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 3)
if err != nil {
return "", err
}
chi := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
imgs[0].InsertBottom(tou, 0, 0, 1, 38).Im,
imgs[1].InsertBottom(tou, 0, 0, 1, 38).Im,
imgs[2].InsertBottom(tou, 0, 0, 1, 38).Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(1, chi))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(1, chi))
}
// 蹭
func (cc *context) ceng() string {
// A
func (cc *context) A蹭() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "蹭.gif"
c := dlrange("ceng", 6)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Circle(0).Im
tou2 := img.LoadFirstFrame(cc.headimgsdir[1], 100, 100).Circle(0).Im
c := dlrange("ceng", 6, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(100, 100)
if err != nil {
return "", err
}
tou2, err := cc.getLogo2(100, 100)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 6)
if err != nil {
return "", err
}
ceng := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 75, 77, 40, 88).InsertUp(tou2, 77, 103, 102, 81).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 75, 77, 46, 100).InsertUp(img.Rotate(tou2, 10, 62, 127).Im, 0, 0, 92, 40).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertUp(tou, 75, 77, 67, 99).InsertUp(tou2, 76, 117, 90, 8).Im,
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertUp(tou, 75, 77, 52, 83).InsertUp(img.Rotate(tou2, -40, 94, 94).Im, 0, 0, 53, -20).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertUp(tou, 75, 77, 56, 110).InsertUp(img.Rotate(tou2, -66, 132, 80).Im, 0, 0, 78, 40).Im,
img.LoadFirstFrame(*<-(*c)[5], 0, 0).InsertUp(tou, 75, 77, 62, 102).InsertUp(tou2, 71, 100, 110, 94).Im,
imgs[0].InsertUp(tou, 75, 77, 40, 88).InsertUp(tou2, 77, 103, 102, 81).Im,
imgs[1].InsertUp(tou, 75, 77, 46, 100).InsertUp(img.Rotate(tou2, 10, 62, 127).Im, 0, 0, 92, 40).Im,
imgs[2].InsertUp(tou, 75, 77, 67, 99).InsertUp(tou2, 76, 117, 90, 8).Im,
imgs[3].InsertUp(tou, 75, 77, 52, 83).InsertUp(img.Rotate(tou2, -40, 94, 94).Im, 0, 0, 53, -20).Im,
imgs[4].InsertUp(tou, 75, 77, 56, 110).InsertUp(img.Rotate(tou2, -66, 132, 80).Im, 0, 0, 78, 40).Im,
imgs[5].InsertUp(tou, 75, 77, 62, 102).InsertUp(tou2, 71, 100, 110, 94).Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(8, ceng))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(8, ceng))
}
// 啃
func (cc *context) ken() string {
// A
func (cc *context) A啃() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "啃.gif"
c := dlrange("ken", 16)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 100, 100).Im
c := dlrange("ken", 16, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(100, 100)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 16)
if err != nil {
return "", err
}
ken := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertBottom(tou, 90, 90, 105, 150).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertBottom(tou, 90, 83, 96, 172).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertBottom(tou, 90, 90, 106, 148).Im,
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertBottom(tou, 88, 88, 97, 167).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertBottom(tou, 90, 85, 89, 179).Im,
img.LoadFirstFrame(*<-(*c)[5], 0, 0).InsertBottom(tou, 90, 90, 106, 151).Im,
img.LoadFirstFrame(*<-(*c)[6], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[7], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[8], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[9], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[10], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[11], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[12], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[13], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[14], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[15], 0, 0).Im,
imgs[0].InsertBottom(tou, 90, 90, 105, 150).Im,
imgs[1].InsertBottom(tou, 90, 83, 96, 172).Im,
imgs[2].InsertBottom(tou, 90, 90, 106, 148).Im,
imgs[3].InsertBottom(tou, 88, 88, 97, 167).Im,
imgs[4].InsertBottom(tou, 90, 85, 89, 179).Im,
imgs[5].InsertBottom(tou, 90, 90, 106, 151).Im,
imgs[6].Im,
imgs[7].Im,
imgs[8].Im,
imgs[9].Im,
imgs[10].Im,
imgs[11].Im,
imgs[12].Im,
imgs[13].Im,
imgs[14].Im,
imgs[15].Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(7, ken))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(7, ken))
}
// 拍
func (cc *context) pai() string {
// A
func (cc *context) A拍() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "拍.gif"
c := dlrange("pai", 2)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 30, 30).Circle(0).Im
c := dlrange("pai", 2, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
tou, err := cc.getLogo(30, 30)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 2)
if err != nil {
return "", err
}
pai := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 0, 0, 1, 47).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 0, 0, 1, 67).Im,
imgs[0].InsertUp(tou, 0, 0, 1, 47).Im,
imgs[1].InsertUp(tou, 0, 0, 1, 67).Im,
}
_ = writer.SaveGIF2Path(name, img.MergeGif(1, pai))
return "file:///" + name
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(1, pai))
}
// 冲
func (cc *context) chong() string {
// A
func (cc *context) A冲() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "冲.gif"
c := dlrange("xqe", 2)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
chong := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 30, 30, 15, 53).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 30, 30, 40, 53).Im,
c := dlrange("xqe", 2, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
_ = writer.SaveGIF2Path(name, img.MergeGif(1, chong))
return "file:///" + name
tou, err := cc.getLogo(0, 0)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 2)
if err != nil {
return "", err
}
chong := []*image.NRGBA{
imgs[0].InsertUp(tou, 30, 30, 15, 53).Im,
imgs[1].InsertUp(tou, 30, 30, 40, 53).Im,
}
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(1, chong))
}
// 丢
func (cc *context) diu() string {
// A
func (cc *context) A丢() (string, error) {
var wg sync.WaitGroup
var err error
var m sync.Mutex
name := cc.usrdir + "丢.gif"
c := dlrange("diu", 8)
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
diu := []*image.NRGBA{
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 32, 32, 108, 36).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 32, 32, 122, 36).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertUp(tou, 123, 123, 19, 129).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertUp(tou, 185, 185, -50, 200).InsertUp(tou, 33, 33, 289, 70).Im,
img.LoadFirstFrame(*<-(*c)[5], 0, 0).InsertUp(tou, 32, 32, 280, 73).Im,
img.LoadFirstFrame(*<-(*c)[6], 0, 0).InsertUp(tou, 35, 35, 259, 31).Im,
img.LoadFirstFrame(*<-(*c)[7], 0, 0).InsertUp(tou, 175, 175, -50, 220).Im,
c := dlrange("diu", 8, &wg, func(e error) {
m.Lock()
err = e
m.Unlock()
})
if err != nil {
return "", err
}
_ = writer.SaveGIF2Path(name, img.MergeGif(7, diu))
return "file:///" + name
tou, err := cc.getLogo(0, 0)
if err != nil {
return "", err
}
wg.Wait()
if err != nil {
return "", err
}
imgs, err := LoadFirstFrames(c, 8)
if err != nil {
return "", err
}
diu := []*image.NRGBA{
imgs[0].InsertUp(tou, 32, 32, 108, 36).Im,
imgs[1].InsertUp(tou, 32, 32, 122, 36).Im,
imgs[2].Im,
imgs[3].InsertUp(tou, 123, 123, 19, 129).Im,
imgs[4].InsertUp(tou, 185, 185, -50, 200).InsertUp(tou, 33, 33, 289, 70).Im,
imgs[5].InsertUp(tou, 32, 32, 280, 73).Im,
imgs[6].InsertUp(tou, 35, 35, 259, 31).Im,
imgs[7].InsertUp(tou, 175, 175, -50, 220).Im,
}
return "file:///" + name, writer.SaveGIF2Path(name, img.MergeGif(7, diu))
}

View File

@@ -1,19 +1,41 @@
package gif
import (
"image"
"strconv"
"strings"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img"
)
func (cc *context) prepareLogos(s ...string) {
func (cc *context) prepareLogos(s ...string) error {
for i, v := range s {
_, err := strconv.Atoi(v)
if err != nil {
_ = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif", true)
} else {
_ = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif", true)
}
if err != nil {
return err
}
}
return nil
}
func (cc *context) getLogo(w int, h int) (*image.NRGBA, error) {
frame, err := img.LoadFirstFrame(cc.headimgsdir[0], w, h)
if err != nil {
return nil, err
}
return frame.Circle(0).Im, nil
}
func (cc *context) getLogo2(w int, h int) (*image.NRGBA, error) {
frame, err := img.LoadFirstFrame(cc.headimgsdir[1], w, h)
if err != nil {
return nil, err
}
return frame.Circle(0).Im, nil
}

View File

@@ -1,6 +1,7 @@
package gif
import (
"errors"
"image"
"math/rand"
"strconv"
@@ -9,62 +10,85 @@ import (
"github.com/FloatTech/zbputils/img/writer"
)
// 爬
func (cc *context) pa() string {
// A
func (cc *context) A爬() (string, error) {
name := cc.usrdir + `爬.png`
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Circle(0).Im
tou, err := cc.getLogo(0, 0)
if err != nil {
return "", err
}
// 随机爬图序号
rand := rand.Intn(60) + 1
dc := img.LoadFirstFrame(dlblock(`pa/`+strconv.Itoa(rand)+`.png`), 0, 0).
InsertBottom(tou, 100, 100, 0, 400).Im
_ = writer.SavePNG2Path(name, dc)
return "file:///" + name
f, err := dlblock(`pa/` + strconv.Itoa(rand) + `.png`)
if err != nil {
return "", err
}
imgf, err := img.LoadFirstFrame(f, 0, 0)
if err != nil {
return "", err
}
return "file:///" + name, writer.SavePNG2Path(name, imgf.InsertBottom(tou, 100, 100, 0, 400).Im)
}
// 撕
func (cc *context) si() string {
// A
func (cc *context) A撕() (string, error) {
name := cc.usrdir + `撕.png`
tou := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0).Im
tou, err := cc.getLogo(0, 0)
if err != nil {
return "", err
}
im1 := img.Rotate(tou, 20, 380, 380)
im2 := img.Rotate(tou, -12, 380, 380)
dc := img.LoadFirstFrame(dlblock(`si/0.png`), 0, 0).
InsertBottom(im1.Im, im1.W, im1.H, -3, 370).
InsertBottom(im2.Im, im2.W, im2.H, 653, 310).Im
_ = writer.SavePNG2Path(name, dc)
return "file:///" + name
f, err := dlblock(`si/0.png`)
if err != nil {
return "", err
}
imgf, err := img.LoadFirstFrame(f, 0, 0)
if err != nil {
return "", err
}
return "file:///" + name, writer.SavePNG2Path(name, imgf.InsertBottom(im1.Im, im1.W, im1.H, -3, 370).InsertBottom(im2.Im, im2.W, im2.H, 653, 310).Im)
}
// 简单
func (cc *context) other(value ...string) string {
func (cc *context) other(value ...string) (string, error) {
name := cc.usrdir + value[0] + `.png`
// 加载图片
im := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0)
var a *image.NRGBA
im, err := img.LoadFirstFrame(cc.headimgsdir[0], 0, 0)
if err != nil {
return "", err
}
var imgnrgba *image.NRGBA
switch value[0] {
case "上翻", "下翻":
a = im.FlipV().Im
imgnrgba = im.FlipV().Im
case "左翻", "右翻":
a = im.FlipH().Im
imgnrgba = im.FlipH().Im
case "反色":
a = im.Invert().Im
imgnrgba = im.Invert().Im
case "灰度":
a = im.Grayscale().Im
imgnrgba = im.Grayscale().Im
case "负片":
a = im.Invert().Grayscale().Im
imgnrgba = im.Invert().Grayscale().Im
case "浮雕":
a = im.Convolve3x3().Im
imgnrgba = im.Convolve3x3().Im
case "打码":
a = im.Blur(10).Im
imgnrgba = im.Blur(10).Im
case "旋转":
r, _ := strconv.ParseFloat(value[1], 64)
a = img.Rotate(im.Im, r, 0, 0).Im
imgnrgba = img.Rotate(im.Im, r, 0, 0).Im
case "变形":
w, _ := strconv.Atoi(value[1])
h, _ := strconv.Atoi(value[2])
a = img.Size(im.Im, w, h).Im
w, err := strconv.Atoi(value[1])
if err != nil {
return "", err
}
h, err := strconv.Atoi(value[2])
if err != nil {
return "", err
}
imgnrgba = img.Size(im.Im, w, h).Im
default:
return "", errors.New("no such method")
}
_ = writer.SavePNG2Path(name, a)
return "file:///" + name
return "file:///" + name, writer.SavePNG2Path(name, imgnrgba)
}

View File

@@ -4,6 +4,7 @@ package gif
import (
"math/rand"
"os"
"reflect"
"strconv"
"strings"
"time"
@@ -13,7 +14,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
@@ -24,13 +25,9 @@ var (
)
func init() { // 插件主体
_ = os.RemoveAll(datapath) // 清除缓存图片
err := os.MkdirAll(datapath, 0755)
if err != nil {
panic(err)
}
_ = os.MkdirAll(datapath, 0755)
rand.Seed(time.Now().UnixNano()) // 设置种子
control.Register("gif", order.PrioGIF, &control.Options{
control.Register("gif", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "制图\n- " + strings.Join(cmds, "\n- "),
}).ApplySingle(ctxext.DefaultSingle).OnRegex(`^(` + strings.Join(cmds, "|") + `)\D*?(\[CQ:(image\,file=([0-9a-zA-Z]{32}).*|at.+?(\d{5,11}))\].*|(\d+))$`).
@@ -39,31 +36,19 @@ func init() { // 插件主体
list := ctx.State["regex_matched"].([]string)
c.prepareLogos(list[4]+list[5]+list[6], strconv.FormatInt(ctx.Event.UserID, 10))
var picurl string
switch list[1] {
case "爬":
picurl = c.pa()
case "摸":
picurl = c.mo()
case "吃":
picurl = c.chi()
case "啃":
picurl = c.ken()
case "蹭":
picurl = c.ceng()
case "敲":
picurl = c.qiao()
case "搓":
picurl = c.cuo()
case "拍":
picurl = c.pai()
case "丢":
picurl = c.diu()
case "撕":
picurl = c.si()
case "冲":
picurl = c.chong()
default:
picurl = c.other(list[1]) // "灰度", "上翻", "下翻", "左翻", "右翻", "反色", "倒放", "浮雕", "打码", "负片"
var err error
if len([]rune(list[1])) == 1 {
r := reflect.ValueOf(c).MethodByName("A" + list[1]).Call(nil)
picurl = r[0].String()
if !r[1].IsNil() {
err = r[1].Interface().(error)
}
} else {
picurl, err = c.other(list[1]) // "灰度", "上翻", "下翻", "左翻", "右翻", "反色", "倒放", "浮雕", "打码", "负片"
}
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Image(picurl))
})

View File

@@ -13,13 +13,13 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/tidwall/gjson"
)
func init() { // 插件主体
control.Register("github", order.PrioGithub, &control.Options{
control.Register("github", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "GitHub仓库搜索\n" +
"- >github [xxx]\n" +

View File

@@ -17,7 +17,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
@@ -52,7 +52,7 @@ func init() {
panic(err)
}
engine := control.Register("hs", order.PrioHS, &control.Options{
engine := control.Register("hs", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "炉石\n" +
"- 搜卡[xxxx]\n" +

View File

@@ -11,11 +11,11 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/imgpool"
"github.com/FloatTech/zbputils/img/pool"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
type resultjson struct {
@@ -65,7 +65,7 @@ type resultjson struct {
}
func init() {
control.Register("imgfinder", order.PrioImageFinder, &control.Options{
control.Register("imgfinder", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "关键字搜图\n" +
"- 来张 [xxx]",
@@ -77,7 +77,7 @@ func init() {
rannum := randintn(len(soutujson.Illusts))
pom2 := soutujson.Illusts[rannum].ImageUrls.Medium[19:]
u := pom1 + pom2
m, hassent, err := imgpool.NewImage(ctxext.Send(ctx), ctxext.GetMessage(ctx), u[strings.LastIndex(u, "/")+1:], u)
m, hassent, err := pool.NewImage(ctxext.Send(ctx), ctxext.GetMessage(ctx), u[strings.LastIndex(u, "/")+1:], u)
if err == nil && !hassent {
ctx.SendChain(message.Image(m.String()))
}

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/process"
log "github.com/sirupsen/logrus"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const dbpath = "data/Jandan/"

View File

@@ -14,7 +14,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -22,7 +22,7 @@ const (
)
func init() {
engine := control.Register("jandan", order.PrioJandan, &control.Options{
engine := control.Register("jandan", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "煎蛋网无聊图\n- 来份屌图\n- 更新屌图\n",
})
@@ -74,7 +74,7 @@ func init() {
mu.RUnlock()
if !ok {
mu.Lock()
db.Insert("picture", &picture{ID: i, URL: u})
_ = db.Insert("picture", &picture{ID: i, URL: u})
mu.Unlock()
} else {
// 开始重复,说明之后都是重复

View File

@@ -15,7 +15,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -25,7 +25,7 @@ const (
)
func init() {
control.Register("juejuezi", order.PrioJueJueZi, &control.Options{
control.Register("juejuezi", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "绝绝子生成器\n" +
"- 喝奶茶绝绝子 | 绝绝子吃饭",

View File

@@ -13,11 +13,11 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/imgpool"
"github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -30,7 +30,7 @@ var (
)
func init() {
control.Register("lolicon", order.PrioLolicon, &control.Options{
control.Register("lolicon", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "lolicon\n" +
"- 来份萝莉",
@@ -57,7 +57,7 @@ func init() {
url := json.Get("data.0.urls.original").Str
url = strings.ReplaceAll(url, "i.pixiv.cat", "i.pixiv.re")
name := url[strings.LastIndex(url, "/")+1 : len(url)-4]
m, err := imgpool.GetImage(name)
m, err := pool.GetImage(name)
if err != nil {
m.SetFile(url)
_, err = m.Push(ctxext.SendToSelf(ctx), ctxext.GetMessage(ctx))

View File

@@ -20,7 +20,8 @@ import (
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_manager/timer"
)
@@ -59,12 +60,12 @@ var (
clock timer.Clock
)
var engine = control.Register("manager", order.PrioManager, &control.Options{
DisableOnDefault: false,
Help: hint,
})
func init() { // 插件主体
engine := control.Register("manager", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: hint,
})
go func() {
defer order.DoneOnExit()()
process.SleepAbout1sTo2s()
@@ -79,6 +80,7 @@ func init() { // 插件主体
panic(err)
}
}()
// 升为管理
engine.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {

View File

@@ -4,11 +4,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"strings"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
)
type resultjson struct {
@@ -41,27 +36,6 @@ var (
servers = make(map[string]string)
)
func init() {
// 这里填对应mc服务器的登录地址
servers["ftbi"] = "115.28.186.22:25710"
servers["ges"] = "115.28.186.22:25701"
engine.OnCommand("mclist").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
// 支持多个服务器
gesjson := infoapi(servers[model.Args])
var str = gesjson.Players.List
cs := strings.Join(str, "\n")
ctx.SendChain(message.Text(
"服务器名字: ", gesjson.Motd.Raw[0], "\n",
"在线人数: ", gesjson.Players.Online, "/", gesjson.Players.Max, "\n",
"以下为玩家名字: ", "\n", cs,
))
})
}
// 开放api请求调用
func infoapi(addr string) *resultjson {
url := "https://api.mcsrvstat.us/2/" + addr

View File

@@ -5,13 +5,14 @@ import (
"fmt"
"io/ioutil"
"net/http"
"strings"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
// 此功能实现依赖MCSManager项目对服务器的管理apimc服务器如果没有在该管理平台部署此功能无效
@@ -20,16 +21,15 @@ import (
const api = "http://your.addr:23333/api/start_server/%s/?apikey=apikey"
var engine = control.Register("minecraft", order.PrioMinecraft, &control.Options{
DisableOnDefault: false,
Help: "minecraft\n" +
"- /mcstart xxx\n" +
"- /mcstop xxx\n" +
"- /mclist servername\n" +
"- https://github.com/Suwings/MCSManager",
})
func init() {
engine := control.Register("minecraft", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "minecraft\n" +
"- /mcstart xxx\n" +
"- /mcstop xxx\n" +
"- /mclist servername\n" +
"- https://github.com/Suwings/MCSManager",
})
engine.OnCommand("mcstart").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
@@ -46,6 +46,25 @@ func init() {
result := stop(model.Args)
ctx.SendChain(message.Text(result))
})
// 这里填对应mc服务器的登录地址
servers["ftbi"] = "115.28.186.22:25710"
servers["ges"] = "115.28.186.22:25701"
engine.OnCommand("mclist").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
model := extension.CommandModel{}
_ = ctx.Parse(&model)
// 支持多个服务器
gesjson := infoapi(servers[model.Args])
var str = gesjson.Players.List
cs := strings.Join(str, "\n")
ctx.SendChain(message.Text(
"服务器名字: ", gesjson.Motd.Raw[0], "\n",
"在线人数: ", gesjson.Players.Online, "/", gesjson.Players.Max, "\n",
"以下为玩家名字: ", "\n", cs,
))
})
}
// 开启服务器的api请求

View File

@@ -9,51 +9,23 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() { // 插件主体
control.Register("moyu", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "moyu\n" +
"- /启用 moyu\n" +
"- /禁用 moyu",
})
// 定时任务每天10点执行一次
c := cron.New()
_, err := c.AddFunc("0 10 * * *", func() { sendNotice() })
if err == nil {
c.Start()
}
control.Register("moyu", order.PrioMoyu, &control.Options{
DisableOnDefault: true,
Help: "moyu\n" +
"- 添加摸鱼提醒\n" +
"- 删除摸鱼提醒",
}).OnFullMatch("删除摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("moyu")
if ok {
if m.IsEnabledIn(ctx.Event.GroupID) {
m.Disable(ctx.Event.GroupID)
ctx.Send(message.Text("删除成功!"))
} else {
ctx.Send(message.Text("未启用!"))
}
} else {
ctx.Send(message.Text("找不到该服务!"))
}
})
zero.OnFullMatch("添加摸鱼提醒", zero.OnlyGroup, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
m, ok := control.Lookup("moyu")
if ok {
if m.IsEnabledIn(ctx.Event.GroupID) {
ctx.Send(message.Text("已启用!"))
} else {
m.Enable(ctx.Event.GroupID)
ctx.Send(message.Text("添加成功!"))
}
} else {
ctx.Send(message.Text("找不到该服务!"))
}
})
}
// 获取数据拼接消息链并发送

View File

@@ -17,11 +17,11 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
control.Register("music", order.PrioMusic, &control.Options{
control.Register("music", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "点歌\n" +
"- 点歌[xxx]\n" +

View File

@@ -17,7 +17,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
// setuclass holds setus in a folder, which is the class name.

View File

@@ -10,10 +10,10 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/rule"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -27,7 +27,7 @@ var (
)
func init() {
engine := control.Register("nativesetu", order.PrioNativeSetu, &control.Options{
engine := control.Register("nativesetu", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "本地涩图\n" +
"- 本地[xxx]\n" +
@@ -36,7 +36,7 @@ func init() {
"- 刷新所有本地setu\n" +
"- 所有本地setu分类",
})
engine.OnRegex(`^本地(.*)$`, rule.FirstValueInList(ns)).SetBlock(true).
engine.OnRegex(`^本地(.*)$`, ctxext.FirstValueInList(ns)).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
imgtype := ctx.State["regex_matched"].([]string)[1]
sc := new(setuclass)
@@ -50,7 +50,7 @@ func init() {
ctx.SendChain(message.Text(imgtype, ": ", sc.Name, "\n"), message.Image(p))
}
})
engine.OnRegex(`^刷新本地(.*)$`, rule.FirstValueInList(ns), zero.SuperUserPermission).SetBlock(true).
engine.OnRegex(`^刷新本地(.*)$`, ctxext.FirstValueInList(ns), zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
imgtype := ctx.State["regex_matched"].([]string)[1]
err := ns.scanclass(os.DirFS(setupath), imgtype, imgtype)

View File

@@ -16,7 +16,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
@@ -32,7 +32,7 @@ func init() {
if err != nil {
panic(err)
}
engine := control.Register("nwife", order.PrioNativeWife, &control.Options{
engine := control.Register("nwife", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "nativewife\n- 抽wife[@xxx]\n- 添加wife[名字][图片]\n- 删除wife[名字]\n- [让 | 不让]所有人均可添加wife",
})
@@ -62,7 +62,7 @@ func init() {
}
})
// 上传一张图
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, ctxext.MustGiven).SetBlock(true).
engine.OnPrefix("添加wife", zero.OnlyGroup, chkAddWifePermission, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
name := ""
for _, elem := range ctx.Event.Message {

View File

@@ -12,11 +12,11 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
control.Register("nbnhhsh", order.PrioNBNHHSH, &control.Options{
control.Register("nbnhhsh", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "拼音首字母释义工具\n- ?? [缩写]",
}).OnRegex(`^[?]{1,2} ?([a-z0-9]+)$`).SetBlock(false).

View File

@@ -21,7 +21,7 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -37,16 +37,13 @@ const (
idReg = `/(\d+)/`
)
var (
gCurCookieJar *cookiejar.Jar
engine = control.Register("novel", order.PrioNovel, &control.Options{
DisableOnDefault: false,
Help: "铅笔小说网搜索\n- 小说[xxx]",
})
)
var gCurCookieJar *cookiejar.Jar
func init() {
engine.OnRegex("^小说([\u4E00-\u9FA5A-Za-z0-9]{1,25})$").SetBlock(true).Limit(ctxext.LimitByUser).
control.Register("novel", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "铅笔小说网搜索\n- 小说[xxx]",
}).OnRegex("^小说([\u4E00-\u9FA5A-Za-z0-9]{1,25})$").SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text("少女祈祷中......"))
login(username, password)

View File

@@ -9,16 +9,16 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
engine := control.Register("nsfw", order.PrioNSFW, &control.Options{
engine := control.Register("nsfw", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "nsfw图片识别\n- nsfw打分[图片]",
}).ApplySingle(ctxext.DefaultSingle)
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
engine.OnKeywordGroup([]string{"nsfw打分"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {
@@ -31,11 +31,11 @@ func init() {
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(judge(p[0]))))
}
})
en := control.Register("nsfwauto", order.PrioNSFWAuto, &control.Options{
en := control.Register("nsfwauto", order.AcquirePrio(), &control.Options{
DisableOnDefault: true,
Help: "nsfw图片自动识别\n- 当图片属于非 neutral 类别时自动发送评价",
})
en.OnMessage(ctxext.Exists).SetBlock(false).
en.OnMessage(ctxext.IsPicExists).SetBlock(false).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -16,22 +16,17 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
bed = "https://gitcode.net/u011570312/senso-ji-omikuji/-/raw/main/%d_%d.jpg"
)
const bed = "https://gitcode.net/u011570312/senso-ji-omikuji/-/raw/main/%d_%d.jpg"
var (
engine = control.Register("omikuji", order.PrioOmikuji, &control.Options{
func init() { // 插件主体
engine := control.Register("omikuji", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "浅草寺求签\n" +
"- 求签 | 占卜\n- 解签",
}).ApplySingle(ctxext.DefaultSingle)
)
func init() { // 插件主体
engine.OnFullMatchGroup([]string{"求签", "占卜"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
miku := bangoToday(ctx.Event.UserID)

View File

@@ -10,7 +10,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -10,12 +10,12 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
rand.Seed(time.Now().UnixNano())
control.Register("reborn", order.PrioReborn, &control.Options{
control.Register("reborn", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "投胎\n- reborn",
}).OnFullMatch("reborn").SetBlock(true).

View File

@@ -14,7 +14,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/tidwall/gjson"
)
@@ -93,7 +93,7 @@ var (
)
func init() {
control.Register("runcode", order.PrioRuncode, &control.Options{
control.Register("runcode", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "在线代码运行: \n" +
">runcode [language] [code block]\n" +

View File

@@ -11,17 +11,17 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/imgpool"
"github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/process"
"github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() { // 插件主体
engine := control.Register("saucenao", order.PrioSauceNao, &control.Options{
engine := control.Register("saucenao", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "搜图\n" +
"- 以图搜图 | 搜索图片 | 以图识图[图片]\n" +
@@ -45,7 +45,7 @@ func init() { // 插件主体
n := name + "_p" + strconv.Itoa(i)
filepath := file.BOTPATH + "/" + pixiv.CacheDir + n
f := ""
m, err := imgpool.GetImage(n)
m, err := pool.GetImage(n)
if err == nil {
imgs = append(imgs, message.Image(m.String()))
continue
@@ -97,7 +97,7 @@ func init() { // 插件主体
}
})
// 以图搜图
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
engine.OnKeywordGroup([]string{"以图搜图", "搜索图片", "以图识图"}, zero.OnlyGroup, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))

View File

@@ -14,7 +14,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const cachedir = "data/scale/"
@@ -25,12 +25,12 @@ func init() {
if err != nil {
panic(err)
}
engine := control.Register("scale", order.PrioScale, &control.Options{
engine := control.Register("scale", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "叔叔的AI二次元图片放大\n- 放大图片[图片]",
}).ApplySingle(ctxext.DefaultSingle)
// 上传一张图进行评价
engine.OnKeywordGroup([]string{"放大图片"}, zero.OnlyGroup, ctxext.CmdMatch, ctxext.MustGiven, getPara).SetBlock(true).
engine.OnKeywordGroup([]string{"放大图片"}, zero.OnlyGroup, ctxext.MustProvidePicture, getPara).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
url := ctx.State["image_url"].([]string)
if len(url) > 0 {

View File

@@ -9,7 +9,7 @@ import (
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (

View File

@@ -17,11 +17,12 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/img"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/zbputils/img/writer"
"github.com/FloatTech/zbputils/web"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -33,15 +34,13 @@ const (
SCOREMAX = 120
)
var (
engine = control.Register("score", order.PrioScore, &control.Options{
var levelArray = [...]int{0, 1, 2, 5, 10, 20, 35, 55, 75, 100, 120}
func init() {
engine := control.Register("score", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "签到得分\n- 签到\n- 获得签到背景[@xxx] | 获得签到背景",
})
levelArray = [...]int{0, 1, 2, 5, 10, 20, 35, 55, 75, 100, 120}
)
func init() {
engine.OnFullMatch("签到", zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
uid := ctx.Event.UserID
@@ -72,6 +71,25 @@ func init() {
ctx.SendChain(message.Text("ERROR:", err))
return
}
// 避免图片过大,最大 1280*720
x := back.Bounds().Size().X
y := back.Bounds().Size().Y
hasChanged := false
if x > 1280 {
y = y * 1280 / x
x = 1280
hasChanged = true
}
if y > 720 {
x = x * 720 / y
y = 720
hasChanged = true
}
if hasChanged {
back = img.Size(back, x, y).Im
}
canvas := gg.NewContext(back.Bounds().Size().X, int(float64(back.Bounds().Size().Y)*1.7))
canvas.SetRGB(1, 1, 1)
canvas.Clear()

View File

@@ -15,14 +15,13 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
fileutil "github.com/FloatTech/zbputils/file"
imagepool "github.com/FloatTech/zbputils/imgpool"
imagepool "github.com/FloatTech/zbputils/img/pool"
"github.com/FloatTech/zbputils/math"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/zbputils/rule"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
// Pools 图片缓冲池
@@ -69,7 +68,7 @@ func init() { // 插件主体
}
}()
engine := control.Register("setutime", order.PrioSetuTime, &control.Options{
engine := control.Register("setutime", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "涩图\n" +
"- 来份[涩图/二次元/风景/车万]\n" +
@@ -77,7 +76,7 @@ func init() { // 插件主体
"- 删除[涩图/二次元/风景/车万][P站图片ID]\n" +
"- >setu status",
})
engine.OnRegex(`^来份(.*)$`, rule.FirstValueInList(pool)).SetBlock(true).Limit(ctxext.LimitByUser).
engine.OnRegex(`^来份(.*)$`, ctxext.FirstValueInList(pool)).SetBlock(true).Limit(ctxext.LimitByUser).
Handle(func(ctx *zero.Ctx) {
var imgtype = ctx.State["regex_matched"].([]string)[1]
// 补充池子
@@ -111,7 +110,7 @@ func init() { // 插件主体
ctx.SendChain(message.Text("成功向分类", imgtype, "添加图片", id))
})
engine.OnRegex(`^删除(.*?)(\d+)$`, rule.FirstValueInList(pool), zero.SuperUserPermission).SetBlock(true).
engine.OnRegex(`^删除(.*?)(\d+)$`, ctxext.FirstValueInList(pool), zero.SuperUserPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var (
imgtype = ctx.State["regex_matched"].([]string)[1]

View File

@@ -4,7 +4,7 @@ package shadiao
import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
@@ -23,7 +23,7 @@ const (
)
var (
engine = control.Register("shadiao", order.PrioShaDiao, &control.Options{
engine = control.Register("shadiao", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "沙雕app\n" +
"- 哄我\n- 渣我\n- 来碗绿茶\n- 发个朋友圈\n- 来碗毒鸡汤\n- 讲个段子",

View File

@@ -8,7 +8,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
@@ -16,7 +16,7 @@ import (
)
func init() {
engine := control.Register("shindan", order.PrioShinDan, &control.Options{
engine := control.Register("shindan", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "shindan\n" +
"- 今天是什么少女[@xxx]\n" +

View File

@@ -5,7 +5,8 @@ import (
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
)

View File

@@ -11,19 +11,19 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_sleep_manage/model"
)
const dbpath = "data/sleep/"
const dbfile = dbpath + "manage.db"
var engine = control.Register("sleepmanage", order.PrioSleepManage, &control.Options{
DisableOnDefault: false,
Help: "sleepmanage\n- 早安\n- 晚安",
})
func init() {
engine := control.Register("sleepmanage", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "sleepmanage\n- 早安\n- 晚安",
})
engine.OnFullMatch("早安", isMorning, zero.OnlyGroup).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
db, err := model.Open(dbfile)

38
plugin_thesaurus/chat.go Normal file
View File

@@ -0,0 +1,38 @@
// Package thesaurus 修改过的单纯回复插件
package thesaurus
import (
"math/rand"
control "github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/zbputils/control/order"
)
const (
dbpath = "data/Chat/"
dbfile = dbpath + "kimoi.json"
)
var (
engine = control.Register("thesaurus", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "thesaurus\n- 词典匹配回复",
})
kimomap = make(kimo, 256)
chatList = make([]string, 0, 256)
)
func init() {
initThesaurusList(func() {
engine.OnFullMatchGroup(chatList, zero.OnlyToMe).SetBlock(true).Handle(
func(ctx *zero.Ctx) {
key := ctx.MessageString()
val := *kimomap[key]
text := val[rand.Intn(len(val))]
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text)) // 来自于 https://github.com/Kyomotoi/AnimeThesaurus 的回复 经过二次修改
})
})
}

View File

@@ -1,4 +1,4 @@
package chat
package thesaurus
import (
"encoding/json"
@@ -9,12 +9,12 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
type kimo = map[string]*[]string
func initChatList(postinit func()) {
func initThesaurusList(postinit func()) {
go func() {
defer order.DoneOnExit()()
process.SleepAbout1sTo2s()
@@ -30,7 +30,7 @@ func initChatList(postinit func()) {
for k := range kimomap {
chatList = append(chatList, k)
}
logrus.Infoln("[chat]加载", len(chatList), "条kimoi")
logrus.Infoln("[thesaurus]加载", len(chatList), "条kimoi")
postinit()
}()
}

View File

@@ -10,7 +10,7 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
var (
@@ -18,12 +18,12 @@ var (
)
func init() { // 插件主体
engine := control.Register("tracemoe", order.PrioTraceMoe, &control.Options{
engine := control.Register("tracemoe", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "tracemoe\n- 搜番 | 搜索番剧[图片]",
})
// 以图搜图
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, ctxext.CmdMatch, ctxext.MustGiven).SetBlock(true).
engine.OnKeywordGroup([]string{"搜番", "搜索番剧"}, ctxext.MustProvidePicture).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
// 开始搜索图片
ctx.SendChain(message.Text("少女祈祷中......"))

View File

@@ -15,7 +15,7 @@ import (
"github.com/FloatTech/zbputils/ctxext"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func tl(d string) ([]byte, error) {
@@ -38,7 +38,7 @@ func tl(d string) ([]byte, error) {
}
func init() {
control.Register("translation", order.PrioTranslation, &control.Options{
control.Register("translation", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "翻译\n" +
">TL 你好",

View File

@@ -6,7 +6,8 @@ import (
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation/model"
)

View File

@@ -6,7 +6,7 @@ import (
"github.com/FloatTech/zbputils/file"
"github.com/FloatTech/zbputils/process"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
// 加载数据库

View File

@@ -17,7 +17,8 @@ import (
control "github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/img/text"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
"github.com/FloatTech/ZeroBot-Plugin/plugin_vtb_quotation/model"
)
@@ -27,12 +28,11 @@ const (
dbfile = dbpath + "vtb.db"
)
var engine = control.Register("vtbquotation", order.PrioVtbQuotation, &control.Options{
DisableOnDefault: false,
Help: "vtbkeyboard.moe\n- vtb语录\n- 随机vtb\n- 更新vtb\n",
})
func init() {
engine := control.Register("vtbquotation", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "vtbkeyboard.moe\n- vtb语录\n- 随机vtb\n- 更新vtb\n",
})
engine.OnFullMatch("vtb语录").SetBlock(true).
Handle(func(ctx *zero.Ctx) {
var firstIndex int

View File

@@ -9,17 +9,17 @@ import (
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
const (
wangyiyunURL = "http://ovooa.com/API/wyrp/api.php?type=text"
wangyiyunReferer = "http://ovooa.com/"
wangyiyunURL = "https://api.gmit.vip/Api/HotComments?format=text"
wangyiyunReferer = "https://api.gmit.vip/"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
)
func init() {
control.Register("wangyiyun", order.PrioWangYiYun, &control.Options{
control.Register("wangyiyun", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "wangyiyun \n- 来份网易云热评",
}).OnFullMatch("来份网易云热评").SetBlock(true).Limit(ctxext.LimitByUser).

View File

@@ -10,11 +10,11 @@ import (
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/FloatTech/ZeroBot-Plugin/order"
"github.com/FloatTech/zbputils/control/order"
)
func init() {
en := control.Register("wtf", order.PrioWtf, &control.Options{
en := control.Register("wtf", order.AcquirePrio(), &control.Options{
DisableOnDefault: false,
Help: "鬼东西\n- 鬼东西列表\n- 查询鬼东西[序号][@xxx]",
})