diff --git a/main.go b/main.go index 96769e79ce..73b4c64236 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,8 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin_manager" // 群管 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin_thesaurus" // 不是很ex的基础词库 + // ^^^^ // // ^^^^^^^^^^^^^^ // // ^^^^^^^高优先级区^^^^^^^ // diff --git a/plugin_chat/chat.go b/plugin_chat/chat.go index a3dfa79f47..0abc48add5 100644 --- a/plugin_chat/chat.go +++ b/plugin_chat/chat.go @@ -14,19 +14,12 @@ import ( "github.com/FloatTech/zbputils/control/order" ) -const ( - dbpath = "data/Chat/" - dbfile = dbpath + "kimoi.json" -) - var ( poke = rate.NewManager(time.Minute*5, 8) // 戳一戳 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- 设置温度[正整数]\n-", }) - kimomap = make(kimo, 256) - chatList = make([]string, 0, 256) ) func init() { // 插件主体 @@ -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)) - }) - }) } diff --git a/plugin_thesaurus/chat.go b/plugin_thesaurus/chat.go new file mode 100644 index 0000000000..b52acd6c70 --- /dev/null +++ b/plugin_thesaurus/chat.go @@ -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/thesaurus/" + dbfile = dbpath + "kimoi_clear.json" +) + +var ( + engine = control.Register("thesaurus", order.AcquirePrio(), &control.Options{ + DisableOnDefault: false, + Help: "thesaurus\n- 稍微干净一点的chat回复 删掉了一些有点ex的w((", + }) + kimogomap = make(kimogo, 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 := *kimogomap[key] + text := val[rand.Intn(len(val))] + ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(text)) // 来自于 https://github.com/Kyomotoi/AnimeThesaurus 的回复 经过二次修改 + }) + }) +} diff --git a/plugin_chat/data.go b/plugin_thesaurus/data.go similarity index 67% rename from plugin_chat/data.go rename to plugin_thesaurus/data.go index 4095aa2415..2bc7b3988a 100644 --- a/plugin_chat/data.go +++ b/plugin_thesaurus/data.go @@ -1,4 +1,4 @@ -package chat +package thesaurus import ( "encoding/json" @@ -12,9 +12,9 @@ import ( "github.com/FloatTech/zbputils/control/order" ) -type kimo = map[string]*[]string +type kimogo = map[string]*[]string -func initChatList(postinit func()) { +func initthesaurusList(postinit func()) { go func() { defer order.DoneOnExit()() process.SleepAbout1sTo2s() @@ -23,14 +23,14 @@ func initChatList(postinit func()) { if err != nil { panic(err) } - err = json.Unmarshal(data, &kimomap) + err = json.Unmarshal(data, &kimogomap) if err != nil { panic(err) } - for k := range kimomap { + for k := range kimogomap { chatList = append(chatList, k) } - logrus.Infoln("[chat]加载", len(chatList), "条kimoi") + logrus.Infoln("[thesaurus]加载", len(chatList), "条kimoi") postinit() }() } diff --git a/plugin_wangyiyun/main.go b/plugin_wangyiyun/main.go index 2209a65f57..23f570d7b8 100644 --- a/plugin_wangyiyun/main.go +++ b/plugin_wangyiyun/main.go @@ -13,8 +13,8 @@ import ( ) 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" )