mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-07 07:40:21 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63f3b3861e | ||
|
|
433b0ae4c1 | ||
|
|
452b39075b | ||
|
|
1001a52a53 | ||
|
|
10c79456a5 | ||
|
|
d0b55bb9dd | ||
|
|
bf4aa59467 | ||
|
|
a402d91367 | ||
|
|
928719f5a1 | ||
|
|
33b00f369f | ||
|
|
6994b27656 | ||
|
|
d46a474364 | ||
|
|
0a5178e0a4 | ||
|
|
34e6cde781 | ||
|
|
bf5feae717 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
data/SetuTime/cache
|
||||
data/SetuTime/search
|
||||
data/manager
|
||||
data/acgimage
|
||||
.idea/
|
||||
.DS_Store
|
||||
.vscode
|
||||
|
||||
@@ -74,6 +74,11 @@
|
||||
- [x] 今天是什么少女[@xxx]
|
||||
- [x] 异世界转生[@xxx]
|
||||
- [x] 卖萌[@xxx]
|
||||
- **gif** `import _ "github.com/tdf1939/ZeroBot-Plugin-Gif/plugin_gif"`
|
||||
- [x] 爬[@xxx]
|
||||
- [x] 摸[@xxx]
|
||||
- [x] 搓[@xxx]
|
||||
- 注:`main.go`中并未import该插件。详情见项目 --> https://github.com/tdf1939/ZeroBot-Plugin-Gif
|
||||
- **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"`
|
||||
- [x] 来份[涩图/二次元/风景/车万]
|
||||
- [x] 添加[涩图/二次元/风景/车万][P站图片ID]
|
||||
@@ -90,6 +95,8 @@
|
||||
- [x] 设置随机图片网址[url]
|
||||
- [x] 太涩了(撤回最近发的图)
|
||||
- [x] 评价图片(发送一张图片让bot评分)
|
||||
- **浅草寺求签** `github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji`
|
||||
- [x] @BOT 求签|运势|占卜
|
||||
- **bilibili** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_bilibili"`
|
||||
- [x] >bili info [名字]
|
||||
- **嘉然** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_diana"`
|
||||
@@ -117,7 +124,6 @@
|
||||
| [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | |
|
||||
|
||||
### 使用稳定版/测试版
|
||||
> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。
|
||||
可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。
|
||||
|
||||
### 本地运行
|
||||
@@ -128,7 +134,6 @@
|
||||
5. 运行 OneBot 框架,并同时运行本插件
|
||||
|
||||
### 编译运行
|
||||
> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。
|
||||
|
||||
#### 利用 Actions 在线编译 (推荐)
|
||||
1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库
|
||||
|
||||
3
go.mod
3
go.mod
@@ -3,7 +3,7 @@ module github.com/FloatTech/ZeroBot-Plugin
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/FloatTech/AnimeAPI v1.1.5
|
||||
github.com/FloatTech/AnimeAPI v1.1.8
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2
|
||||
@@ -12,6 +12,7 @@ require (
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
||||
github.com/tidwall/gjson v1.8.1
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.7 // indirect
|
||||
github.com/wdvxdr1123/ZeroBot v1.2.2
|
||||
modernc.org/sqlite v1.12.0
|
||||
|
||||
7
go.sum
7
go.sum
@@ -1,5 +1,5 @@
|
||||
github.com/FloatTech/AnimeAPI v1.1.5 h1:iZzmqEuzNG7i88cxqDYKpnarTVbAB//a/lIiTcZ1kB4=
|
||||
github.com/FloatTech/AnimeAPI v1.1.5/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/AnimeAPI v1.1.8 h1:v+VxMnYBCn5ANQBXcubzWOD2DZ0RxqwvI9zVBgwl4oE=
|
||||
github.com/FloatTech/AnimeAPI v1.1.8/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk=
|
||||
github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc=
|
||||
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
|
||||
@@ -72,8 +72,9 @@ github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU=
|
||||
github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk=
|
||||
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8=
|
||||
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.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg=
|
||||
github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4=
|
||||
github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8=
|
||||
|
||||
1
main.go
1
main.go
@@ -20,6 +20,7 @@ import (
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false" // 服务器监控
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_minecraft" // MCSManager
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_music" // 点歌
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_omikuji" // 浅草寺求签
|
||||
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan" // 测定
|
||||
|
||||
// b站相关
|
||||
|
||||
@@ -14,8 +14,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
lolipxy = "http://sayuri.fumiama.top:8080/dice?class=0&loli=true&r18=true"
|
||||
apihead = "http://sayuri.fumiama.top:8080/img?path="
|
||||
lolipxy = "https://sayuri.fumiama.top/dice?class=0&loli=true&r18=true"
|
||||
apihead = "https://sayuri.fumiama.top/img?path="
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
var (
|
||||
// ATRI 所有命令的优先级
|
||||
prio = -1
|
||||
// ATRI 表情的 GitHub 镜像位置
|
||||
res = "https://raw.dihe.moe/Yiwen-Chan/ZeroBot-Plugin/master/plugin_atri/"
|
||||
// ATRI 表情的 codechina 镜像
|
||||
res = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/plugin_atri/"
|
||||
// ATRI 的总开关
|
||||
enable = true
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ package data
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
const (
|
||||
datapath = "data/Diana"
|
||||
pbfile = datapath + "/text.pb"
|
||||
pburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/Diana/text.pb"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -41,6 +43,7 @@ func LoadText() error {
|
||||
if _, err := os.Stat(pbfile); err == nil || os.IsExist(err) {
|
||||
f, err := os.Open(pbfile)
|
||||
if err == nil {
|
||||
defer f.Close()
|
||||
data, err1 := io.ReadAll(f)
|
||||
if err1 == nil {
|
||||
if len(data) > 0 {
|
||||
@@ -49,6 +52,26 @@ func LoadText() error {
|
||||
}
|
||||
return err1
|
||||
}
|
||||
} else { // 如果没有小作文,则从 url 下载
|
||||
f, err := os.Create(pbfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
resp, err := http.Get(pburl)
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
if resp.ContentLength > 0 {
|
||||
log.Printf("[Diana]从镜像下载小作文%d字节...", resp.ContentLength)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err == nil && len(data) > 0 {
|
||||
f.Write(data)
|
||||
return compo.Unmarshal(data)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
21
plugin_omikuji/sensou.go
Normal file
21
plugin_omikuji/sensou.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package omikuji
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
bed = "https://codechina.csdn.net/u011570312/senso-ji-omikuji/-/raw/main/%d_%d.jpg"
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
zero.OnFullMatchGroup([]string{"求签", "运势", "占卜"}, zero.OnlyToMe).SetPriority(10).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
miku := rand.Intn(100) + 1
|
||||
ctx.SendChain(message.Image(fmt.Sprintf(bed, miku, 0)), message.Image(fmt.Sprintf(bed, miku, 1)))
|
||||
})
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package setutime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -28,6 +31,10 @@ type imgpool struct {
|
||||
Form int64
|
||||
}
|
||||
|
||||
const (
|
||||
dburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/SetuTime/SetuTime.db"
|
||||
)
|
||||
|
||||
// NewPoolsCache 返回一个缓冲池对象
|
||||
func newPools() *imgpool {
|
||||
cache := &imgpool{
|
||||
@@ -43,6 +50,24 @@ func newPools() *imgpool {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// 如果数据库不存在则下载
|
||||
if _, err := os.Stat(cache.DB.DBPath); err != nil || os.IsNotExist(err) {
|
||||
f, err := os.Create(cache.DB.DBPath)
|
||||
if err == nil {
|
||||
resp, err := http.Get(dburl)
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
if resp.ContentLength > 0 {
|
||||
log.Printf("[Setu]从镜像下载数据库%d字节...", resp.ContentLength)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err == nil && len(data) > 0 {
|
||||
f.Write(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
for i := range cache.List {
|
||||
if err := cache.DB.create(cache.List[i], &pixiv.Illust{}); err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -21,6 +21,7 @@ func init() {
|
||||
zero.OnPrefix("异世界转生", number(587874)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("今天是什么少女", number(162207)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("卖萌", number(360578)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
zero.OnPrefix("抽老婆", number(1075116)).SetBlock(true).FirstPriority().Handle(handle)
|
||||
}
|
||||
|
||||
// shindanmaker 处理函数
|
||||
|
||||
Reference in New Issue
Block a user