diff --git a/README.md b/README.md index e7ddb298..51ce0e5f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![OICQ](https://img.shields.io/badge/OneBot-OICQ-green.svg?style=social&logo=appveyor)](https://github.com/takayama-lily/node-onebot) [![MIRAI](https://img.shields.io/badge/OneBot-Mirai-green.svg?style=social&logo=appveyor)](https://github.com/yyuueexxiinngg/onebot-kotlin) -[![Go Report Card](https://goreportcard.com/badge/github.com/FloatTech/ZeroBot-Plugin?style=flat-square&logo=go)](https://goreportcard.com/report/github.com/github.com/Yiwen-Chan/ZeroBot-Plugin) +[![Go Report Card](https://goreportcard.com/badge/github.com/FloatTech/ZeroBot-Plugin?style=flat-square&logo=go)](https://goreportcard.com/report/github.com/github.com/FloatTech/ZeroBot-Plugin) [![Badge](https://img.shields.io/badge/onebot-v11-black?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAMAAADxPgR5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAxQTFRF////29vbr6+vAAAAk1hCcwAAAAR0Uk5T////AEAqqfQAAAKcSURBVHja7NrbctswDATQXfD//zlpO7FlmwAWIOnOtNaTM5JwDMa8E+PNFz7g3waJ24fviyDPgfhz8fHP39cBcBL9KoJbQUxjA2iYqHL3FAnvzhL4GtVNUcoSZe6eSHizBcK5LL7dBr2AUZlev1ARRHCljzRALIEog6H3U6bCIyqIZdAT0eBuJYaGiJaHSjmkYIZd+qSGWAQnIaz2OArVnX6vrItQvbhZJtVGB5qX9wKqCMkb9W7aexfCO/rwQRBzsDIsYx4AOz0nhAtWu7bqkEQBO0Pr+Ftjt5fFCUEbm0Sbgdu8WSgJ5NgH2iu46R/o1UcBXJsFusWF/QUaz3RwJMEgngfaGGdSxJkE/Yg4lOBryBiMwvAhZrVMUUvwqU7F05b5WLaUIN4M4hRocQQRnEedgsn7TZB3UCpRrIJwQfqvGwsg18EnI2uSVNC8t+0QmMXogvbPg/xk+Mnw/6kW/rraUlvqgmFreAA09xW5t0AFlHrQZ3CsgvZm0FbHNKyBmheBKIF2cCA8A600aHPmFtRB1XvMsJAiza7LpPog0UJwccKdzw8rdf8MyN2ePYF896LC5hTzdZqxb6VNXInaupARLDNBWgI8spq4T0Qb5H4vWfPmHo8OyB1ito+AysNNz0oglj1U955sjUN9d41LnrX2D/u7eRwxyOaOpfyevCWbTgDEoilsOnu7zsKhjRCsnD/QzhdkYLBLXjiK4f3UWmcx2M7PO21CKVTH84638NTplt6JIQH0ZwCNuiWAfvuLhdrcOYPVO9eW3A67l7hZtgaY9GZo9AFc6cryjoeFBIWeU+npnk/nLE0OxCHL1eQsc1IciehjpJv5mqCsjeopaH6r15/MrxNnVhu7tmcslay2gO2Z1QfcfX0JMACG41/u0RrI9QAAAABJRU5ErkJggg==)](https://github.com/howmanybots/onebot) [![Badge](https://img.shields.io/badge/zerobot-v1.3.0-black?style=flat-square&logo=go)](https://github.com/wdvxdr1123/ZeroBot) [![License](https://img.shields.io/github/license/Yiwen-Chan/OneBot-YaYa.svg?style=flat-square&logo=gnu)](https://raw.githubusercontent.com/FloatTech/ZeroBot-Plugin/master/LICENSE) @@ -35,7 +35,7 @@ zerobot -h -t token -u url [-d|w] [-g] qq1 qq2 qq3 ... - **web管理** - 因为开启后可执行文件大约增加 5M ,默认注释不开启。 - 需要配合 [webgui](https://github.com/FloatTech/bot-manager) 使用 -- **动态加载插件** +- **动态加载插件** `import _ github.com/FloatTech/ZeroBot-Plugin-Dynamic/dyloader` - [x] /刷新插件 - [x] /加载插件 service名 - [x] /卸载插件 service名 @@ -182,7 +182,7 @@ zerobot -h -t token -u url [-d|w] [-g] qq1 qq2 qq3 ... ### 本地运行 1. 下载安装 [Go](https://studygolang.com/dl) 环境 -2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压 +2. 下载本项目[压缩包](https://github.com/FloatTech/ZeroBot-Plugin/archive/master.zip),本地解压 3. 编辑 main.go 文件,内容按需修改 4. 双击 build.bat 文件 或 直接双击 run.bat 文件 5. 运行 OneBot 框架,并同时运行本插件 @@ -234,4 +234,4 @@ GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" ## License -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FYiwen-Chan%2FZeroBot-Plugin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FYiwen-Chan%2FZeroBot-Plugin?ref=badge_large) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FFloatTech%2FZeroBot-Plugin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FFloatTech%2FZeroBot-Plugin?ref=badge_large) diff --git a/data/mem.go b/data/mem.go deleted file mode 100644 index 1f2b07f0..00000000 --- a/data/mem.go +++ /dev/null @@ -1,15 +0,0 @@ -package data - -import "unsafe" - -// Str2bytes Fast convert -func Str2bytes(s string) []byte { - x := (*[2]uintptr)(unsafe.Pointer(&s)) - h := [3]uintptr{x[0], x[1], x[1]} - return *(*[]byte)(unsafe.Pointer(&h)) -} - -// Bytes2str Fast convert -func Bytes2str(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/plugin_diana/data/text.go b/plugin_diana/data/text.go index f9c05a5e..a36b797a 100644 --- a/plugin_diana/data/text.go +++ b/plugin_diana/data/text.go @@ -10,8 +10,7 @@ import ( "time" log "github.com/sirupsen/logrus" - - "github.com/FloatTech/ZeroBot-Plugin/data" + "github.com/wdvxdr1123/ZeroBot/utils/helper" ) const ( @@ -43,7 +42,7 @@ func init() { log.Printf("[Diana]读取%d条小作文", arrl) md5s = make([]*[16]byte, arrl) for i, t := range *Array { - m := md5.Sum(data.Str2bytes(t)) + m := md5.Sum(helper.StringToBytes(t)) md5s[i] = &m } } else { @@ -93,7 +92,7 @@ func LoadText() error { // AddText 添加小作文 func AddText(txt string) error { - sum := md5.Sum(data.Str2bytes(txt)) + sum := md5.Sum(helper.StringToBytes(txt)) if txt != "" && !isin(&sum) { m.Lock() defer m.Unlock() diff --git a/plugin_fortune/fortune.go b/plugin_fortune/fortune.go index b38d4c73..c8a1ee9c 100644 --- a/plugin_fortune/fortune.go +++ b/plugin_fortune/fortune.go @@ -17,6 +17,7 @@ import ( "github.com/fogleman/gg" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" + "github.com/wdvxdr1123/ZeroBot/utils/helper" "github.com/FloatTech/ZeroBot-Plugin/control" "github.com/FloatTech/ZeroBot-Plugin/data" @@ -145,7 +146,7 @@ func init() { return } // 发送图片 - ctx.SendChain(message.Image("base64://" + data.Bytes2str(d))) + ctx.SendChain(message.Image("base64://" + helper.BytesToString(d))) }) }