From baf1a80dc285e5c11fb669bce20ebcd427c3d7be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?=
<41315874+fumiama@users.noreply.github.com>
Date: Sun, 13 Oct 2024 18:09:07 +0900
Subject: [PATCH] feat: add plugin emozi & remove vitsnyaru
---
README.md | 18 +++--
go.mod | 12 ++-
go.sum | 28 +++----
main.go | 2 +-
plugin/emozi/main.go | 96 +++++++++++++++++++++++
plugin/niuniu/main.go | 30 ++++----
plugin/poker/poker.go | 4 +-
plugin/vitsnyaru/vitsnyaru.go | 141 ----------------------------------
8 files changed, 141 insertions(+), 190 deletions(-)
create mode 100644 plugin/emozi/main.go
delete mode 100644 plugin/vitsnyaru/vitsnyaru.go
diff --git a/README.md b/README.md
index dd04e69fa3..0c88052daa 100644
--- a/README.md
+++ b/README.md
@@ -667,6 +667,16 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] [emoji][emoji]
+
+
+ 颜文字抽象转写
+
+ `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emozi"`
+
+ - [x] 抽象转写[文段]
+ - [x] 抽象还原[文段]
+ - [x] 抽象登录[用户名]
+
好友申请及群聊邀请事件处理
@@ -1309,14 +1319,6 @@ print("run[CQ:image,file="+j["img"]+"]")
- [x] >TL 你好
-
-
- vits猫雷
-
- `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru"`
-
- - [x] 让猫雷说[xxxx]
-
vtb语录
diff --git a/go.mod b/go.mod
index 1b22220cc6..6282d6a68f 100644
--- a/go.mod
+++ b/go.mod
@@ -4,11 +4,11 @@ go 1.20
require (
github.com/Baidu-AIP/golang-sdk v1.1.1
- github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb
+ github.com/FloatTech/AnimeAPI v1.7.1-0.20241013084507-e77badd1b165
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14
github.com/FloatTech/gg v1.1.3
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef
- github.com/FloatTech/rendercard v0.1.2
+ github.com/FloatTech/rendercard v0.2.0
github.com/FloatTech/sqlite v1.6.3
github.com/FloatTech/ttl v0.0.0-20240716161252-965925764562
github.com/FloatTech/zbpctrl v1.6.2-0.20240904160347-1317e11a15bb
@@ -26,7 +26,7 @@ require (
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
- github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0
+ github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979
github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/jinzhu/gorm v1.9.16
@@ -43,9 +43,9 @@ require (
github.com/wcharczuk/go-chart/v2 v2.1.2
github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240829093431-bea5257d1a2b
gitlab.com/gomidi/midi/v2 v2.1.7
- golang.org/x/image v0.18.0
+ golang.org/x/image v0.21.0
golang.org/x/sys v0.26.0
- golang.org/x/text v0.16.0
+ golang.org/x/text v0.19.0
gopkg.in/yaml.v3 v3.0.1
)
@@ -67,7 +67,6 @@ require (
github.com/jfreymuth/oggvorbis v1.0.1 // indirect
github.com/jfreymuth/vorbis v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
- github.com/kr/text v0.2.0 // indirect
github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect
github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
@@ -78,7 +77,6 @@ require (
github.com/pkumza/numcn v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
- github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/tetratelabs/wazero v1.5.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
diff --git a/go.sum b/go.sum
index 50faaf0b41..de35f13c61 100644
--- a/go.sum
+++ b/go.sum
@@ -1,16 +1,16 @@
github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw=
github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
-github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb h1:j7m84zwcDWLoMLjgG4MDnvanGQoDNnG8A7/aNCnYMIk=
-github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk=
+github.com/FloatTech/AnimeAPI v1.7.1-0.20241013084507-e77badd1b165 h1:HMlRAhARc1xDkT139WXTu8YkyIi4DIHP91yk6PfZB/w=
+github.com/FloatTech/AnimeAPI v1.7.1-0.20241013084507-e77badd1b165/go.mod h1:PxrcdFk46Io/vChKUk/tu7LV/oSmq842hQl36ksHtkM=
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 h1:8O0Iq9MnKsKowltY9txhOqcJdmGTjxHPQ4gEYzbJc9A=
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ=
github.com/FloatTech/gg v1.1.3 h1:+GlL02lTKsxJQr4WCuNwVxC1/eBZrCvypCIBtxuOFb4=
github.com/FloatTech/gg v1.1.3/go.mod h1:/9oLP54CMfq4r+71XL26uaFTJ1uL1boAyX67680/1HE=
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef h1:CJbK/2FRwPuZpeb6M4sWK2d7oXDnBEGhpkQuQrgc91A=
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef/go.mod h1:el5hGpj1C1bDRxcTXYRwEivDCr40zZeJpcrLrB1fajs=
-github.com/FloatTech/rendercard v0.1.2 h1:W4SF9fSxv6Ava+kIUI0T1ILOjId/cgZ0huuEpMpHJbU=
-github.com/FloatTech/rendercard v0.1.2/go.mod h1:Sbojcy1t3NfFz7/WicZRmR/uKFxNMYkKF8qHx69dxY0=
+github.com/FloatTech/rendercard v0.2.0 h1:PBTZ2gCEy/dAEGSfWecrGTrWDYpiBJD1dVzNDDaOxh4=
+github.com/FloatTech/rendercard v0.2.0/go.mod h1:Sbojcy1t3NfFz7/WicZRmR/uKFxNMYkKF8qHx69dxY0=
github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4M=
github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY=
github.com/FloatTech/ttl v0.0.0-20240716161252-965925764562 h1:snfw7FNFym1eNnLrQ/VCf80LiQo9C7jHgrunZDwiRcY=
@@ -35,7 +35,6 @@ github.com/antchfx/xpath v1.3.2 h1:LNjzlsSjinu3bQpw9hWMY9ocB80oLOWuQqFvO6xt51U=
github.com/antchfx/xpath v1.3.2/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/corona10/goimagehash v1.1.0 h1:teNMX/1e+Wn/AYSbLHX8mj+mF9r60R1kBeqE9MkoYwI=
github.com/corona10/goimagehash v1.1.0/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI=
-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -78,8 +77,8 @@ github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4 h1:zN9e09TYKXI1mNku
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4/go.mod h1:iZf1H/Jcw5gjOOFb4C5nlweJtViWc7uwUxRCe14pbYk=
github.com/fumiama/sqlite3 v1.29.10-simp h1:c5y3uKyU0q9t0/SyfynzYyuslQ5zP+5CD8e0yYY554A=
github.com/fumiama/sqlite3 v1.29.10-simp/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA=
-github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 h1:So/3Bg/m2ZcUvqCzzEjjkjHBjcvnV3AN5tCxwsdMwYU=
-github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
+github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979 h1:1xSO4SvPfiw5TVeaS5ASFcl82rXH3jG8Obab0+JOC/8=
+github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6 h1:LtDgr628eji8jRpjPCxsk7ibjcfi97QieZVCTjxLCBw=
github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg=
github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8=
@@ -125,9 +124,6 @@ github.com/jozsefsallai/gophersauce v1.0.1 h1:BA3ovtQRrAb1qYU9JoRLbDHpxnDunlNcEk
github.com/jozsefsallai/gophersauce v1.0.1/go.mod h1:YVEI7djliMTmZ1Vh01YPF8bUHi+oKhe3yXgKf1T49vg=
github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5 h1:BXnB1Gz4y/zwQh+ZFNy7rgd+ZfMOrwRr4uZSHEI+ieY=
github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5/go.mod h1:c9+VS9GaommgIOzNWb5ze4lYwfT8BZ2UDyGiuQTT7yc=
-github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4=
@@ -169,8 +165,6 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
-github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
-github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
@@ -216,8 +210,9 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL
golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
-golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
+golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
+golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 h1:vyLBGJPIl9ZYbcQFM2USFmJBK6KI+t+z6jL0lbwjrnc=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@@ -246,8 +241,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -286,8 +281,9 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
-golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
+golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
+golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
@@ -297,8 +293,8 @@ golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJ
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/main.go b/main.go
index 2a95f0b6cf..947df53c66 100644
--- a/main.go
+++ b/main.go
@@ -86,6 +86,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji
+ _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emozi" // 颜文字抽象转写
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势
@@ -135,7 +136,6 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译
- _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/wantquotes" // 据意查句
_ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件
diff --git a/plugin/emozi/main.go b/plugin/emozi/main.go
new file mode 100644
index 0000000000..c20f45ea33
--- /dev/null
+++ b/plugin/emozi/main.go
@@ -0,0 +1,96 @@
+package emozi
+
+import (
+ "os"
+ "strconv"
+ "strings"
+
+ "github.com/FloatTech/AnimeAPI/emozi"
+ ctrl "github.com/FloatTech/zbpctrl"
+ "github.com/FloatTech/zbputils/control"
+ "github.com/FloatTech/zbputils/ctxext"
+ "github.com/sirupsen/logrus"
+ zero "github.com/wdvxdr1123/ZeroBot"
+ "github.com/wdvxdr1123/ZeroBot/message"
+)
+
+func init() {
+ en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
+ DisableOnDefault: false,
+ Brief: "颜文字抽象转写",
+ Help: "- 抽象转写[文段]\n- 抽象还原[文段]\n- 抽象登录[用户名]",
+ PrivateDataFolder: "emozi",
+ })
+ usr := emozi.Anonymous()
+ data, err := os.ReadFile(en.DataFolder() + "user.txt")
+ if err == nil {
+ arr := strings.Split(string(data), "\n")
+ if len(arr) >= 2 {
+ usr = emozi.NewUser(arr[0], arr[1])
+ err = usr.Login()
+ if err != nil {
+ logrus.Infoln("[emozi]", "以", usr, "身份登录失败:", err)
+ usr = emozi.Anonymous()
+ } else {
+ logrus.Infoln("[emozi]", "以", usr, "身份登录成功")
+ }
+ }
+ }
+
+ en.OnPrefix("抽象转写").Limit(ctxext.LimitByUser).SetBlock(true).Handle(func(ctx *zero.Ctx) {
+ txt := strings.TrimSpace(ctx.State["args"].(string))
+ out, chs, err := usr.Marshal(false, txt)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if len(chs) == 0 {
+ ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(out)))
+ return
+ }
+ for i, c := range chs {
+ ch := ctx.Get("请选择第" + strconv.Itoa(i) + "个多音字(1~" + strconv.Itoa(c) + ")")
+ n, err := strconv.Atoi(ch)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ if n < 1 || n > c {
+ ctx.SendChain(message.Text("ERROR: 输入越界"))
+ return
+ }
+ chs[i] = n - 1
+ }
+ out, _, err = usr.Marshal(false, txt, chs...)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(out)))
+ })
+ en.OnPrefix("抽象还原").Limit(ctxext.LimitByUser).SetBlock(true).Handle(func(ctx *zero.Ctx) {
+ txt := strings.TrimSpace(ctx.State["args"].(string))
+ out, err := usr.Unmarshal(false, txt)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(out)))
+ })
+ en.OnPrefix("抽象登录", zero.OnlyPrivate).Limit(ctxext.LimitByUser).SetBlock(true).Handle(func(ctx *zero.Ctx) {
+ name := strings.TrimSpace(ctx.State["args"].(string))
+ pswd := strings.TrimSpace(ctx.Get("请输入密码"))
+ newusr := emozi.NewUser(name, pswd)
+ err := newusr.Login()
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ err = os.WriteFile(en.DataFolder()+"user.txt", []byte(name+"\n"+pswd), 0644)
+ if err != nil {
+ ctx.SendChain(message.Text("ERROR: ", err))
+ return
+ }
+ ctx.SendChain(message.Text("成功"))
+ })
+}
diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go
index e00c66115f..fede9a7e6c 100644
--- a/plugin/niuniu/main.go
+++ b/plugin/niuniu/main.go
@@ -112,19 +112,19 @@ func init() {
answer = r.Event.Message.String()
n, err := strconv.Atoi(answer)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
info, err := db.findNiuNiu(gid, uid)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
money, err := info.purchaseItem(n)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
@@ -134,12 +134,12 @@ func init() {
}
if err = wallet.InsertWalletOf(uid, -money); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
if err = db.insertNiuNiu(&info, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
@@ -176,20 +176,20 @@ func init() {
}
if err := wallet.InsertWalletOf(uid, -150); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
niuniu, err := db.findNiuNiu(gid, uid)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
niuniu.Length = last.Length
if err = db.insertNiuNiu(&niuniu, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
@@ -260,7 +260,7 @@ func init() {
}
niuniuList, err := db.readAllTable(gid)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕排行:%d\n⭕%s ",
@@ -302,7 +302,7 @@ func init() {
return
}
if err = db.insertNiuNiu(&niuniu, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
@@ -324,12 +324,12 @@ func init() {
// 添加数据进入表
if err := db.insertNiuNiu(&u, gid); err != nil {
if err = db.createGIDTable(gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
if err = db.insertNiuNiu(&u, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
}
@@ -354,7 +354,7 @@ func init() {
fiancee := ctx.State["regex_matched"].([]string)
adduser, err := strconv.ParseInt(fiancee[3]+fiancee[4], 10, 64)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
uid := ctx.Event.UserID
@@ -385,12 +385,12 @@ func init() {
}
if err = db.insertNiuNiu(&myniuniu, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
if err = db.insertNiuNiu(&adduserniuniu, gid); err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return
}
diff --git a/plugin/poker/poker.go b/plugin/poker/poker.go
index 32def3c247..161827c37f 100644
--- a/plugin/poker/poker.go
+++ b/plugin/poker/poker.go
@@ -28,12 +28,12 @@ func init() {
getImg := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool {
data, err := engine.GetLazyData("imgdata.json", true)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return false
}
err = json.Unmarshal(data, &cardImgPathList)
if err != nil {
- ctx.SendChain(message.Text("ERROR:", err))
+ ctx.SendChain(message.Text("ERROR: ", err))
return false
}
return true
diff --git a/plugin/vitsnyaru/vitsnyaru.go b/plugin/vitsnyaru/vitsnyaru.go
deleted file mode 100644
index 709bc5b471..0000000000
--- a/plugin/vitsnyaru/vitsnyaru.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Package vitsnyaru vits猫雷
-package vitsnyaru
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "strings"
- "time"
-
- hf "github.com/FloatTech/AnimeAPI/huggingface"
- ctrl "github.com/FloatTech/zbpctrl"
- "github.com/FloatTech/zbputils/control"
- "github.com/tidwall/gjson"
- zero "github.com/wdvxdr1123/ZeroBot"
- "github.com/wdvxdr1123/ZeroBot/message"
-)
-
-const (
- vitsnyaruRepo = "innnky/vits-nyaru"
-)
-
-func init() { // 插件主体
- engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
- DisableOnDefault: false,
- Brief: "vits猫雷",
- Help: "- 让猫雷说 xxx",
- PrivateDataFolder: "vitsnyaru",
- })
-
- // 开启
- engine.OnPrefix(`让猫雷说`).SetBlock(true).
- Handle(func(ctx *zero.Ctx) {
- _ctx, _cancel := context.WithTimeout(context.Background(), hf.TimeoutMax*time.Second)
- defer _cancel()
- ch := make(chan []byte, 1)
-
- args := ctx.State["args"].(string)
- pushURL := fmt.Sprintf(hf.HTTPSPushPath, vitsnyaruRepo)
- statusURL := fmt.Sprintf(hf.HTTPSStatusPath, vitsnyaruRepo)
- ctx.SendChain(message.Text("少女祈祷中..."))
- var (
- pushReq hf.PushRequest
- pushRes hf.PushResponse
- statusReq hf.StatusRequest
- statusRes hf.StatusResponse
- data []byte
- )
-
- // 获取clean后的文本
- pushReq = hf.PushRequest{
- Action: hf.DefaultAction,
- Data: []interface{}{args},
- FnIndex: 1,
- }
- pushRes, err := hf.Push(pushURL, pushReq)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- statusReq = hf.StatusRequest{
- Hash: pushRes.Hash,
- }
-
- t := time.NewTicker(time.Second * 1)
- defer t.Stop()
- LOOP:
- for {
- select {
- case <-t.C:
- data, err = hf.Status(statusURL, statusReq)
- if err != nil {
- ch <- data
- break LOOP
- }
- if gjson.ParseBytes(data).Get("status").String() == hf.CompleteStatus {
- ch <- data
- break LOOP
- }
- case <-_ctx.Done():
- ch <- data
- break LOOP
- }
- }
-
- data = <-ch
- err = json.Unmarshal(data, &statusRes)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
-
- // 用clean的文本预测语音
- pushReq = hf.PushRequest{
- Action: hf.DefaultAction,
- Data: statusRes.Data.Data,
- FnIndex: 2,
- }
- pushRes, err = hf.Push(pushURL, pushReq)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
- statusReq = hf.StatusRequest{
- Hash: pushRes.Hash,
- }
-
- LOOP2:
- for {
- select {
- case <-t.C:
- data, err = hf.Status(statusURL, statusReq)
- if err != nil {
- ch <- data
- break LOOP2
- }
- if gjson.ParseBytes(data).Get("status").String() == hf.CompleteStatus {
- ch <- data
- break LOOP2
- }
- case <-_ctx.Done():
- ch <- data
- break LOOP2
- }
- }
-
- data = <-ch
- err = json.Unmarshal(data, &statusRes)
- if err != nil {
- ctx.SendChain(message.Text("ERROR: ", err))
- return
- }
-
- // 发送语音
- if len(statusRes.Data.Data) < 2 {
- ctx.SendChain(message.Text("ERROR: 未能获取语音"))
- return
- }
- ctx.SendChain(message.Record("base64://" + strings.TrimPrefix(statusRes.Data.Data[1].(string), "data:audio/wav;base64,")))
- })
-}