diff --git a/README.md b/README.md index 4496dc8e..1c5f290c 100644 --- a/README.md +++ b/README.md @@ -90,10 +90,13 @@ 5. 双击点击 build.bat 文件 6. 运行框架,并同时运行本插件 -#### 利用 Actions 编译 (推荐) +#### 利用 Actions 在线编译 (推荐) 1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库 2. 点击仓库上方的 Actions 按钮,确认使用 Actions 3. 编辑 main.go 文件,内容按需修改,返回仓库 4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件 5. 运行框架,并同时运行本插件 +### 特别感谢 +- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot) +- [ATRI](https://github.com/Kyomotoi/ATRI) \ No newline at end of file diff --git a/atri/AZ.jpg b/atri/AZ.jpg new file mode 100644 index 00000000..c3267556 Binary files /dev/null and b/atri/AZ.jpg differ diff --git a/atri/AZ1.jpg b/atri/AZ1.jpg new file mode 100644 index 00000000..a57948ae Binary files /dev/null and b/atri/AZ1.jpg differ diff --git a/atri/FN.jpg b/atri/FN.jpg new file mode 100644 index 00000000..b1b74f55 Binary files /dev/null and b/atri/FN.jpg differ diff --git a/atri/NO.jpg b/atri/NO.jpg new file mode 100644 index 00000000..331c6da4 Binary files /dev/null and b/atri/NO.jpg differ diff --git a/atri/SUKI.jpg b/atri/SUKI.jpg new file mode 100644 index 00000000..07dfc04c Binary files /dev/null and b/atri/SUKI.jpg differ diff --git a/atri/SUKI1.jpg b/atri/SUKI1.jpg new file mode 100644 index 00000000..133d62c8 Binary files /dev/null and b/atri/SUKI1.jpg differ diff --git a/atri/SUKI2.png b/atri/SUKI2.png new file mode 100644 index 00000000..b1c08494 Binary files /dev/null and b/atri/SUKI2.png differ diff --git a/atri/WH.jpg b/atri/WH.jpg new file mode 100644 index 00000000..66b986a8 Binary files /dev/null and b/atri/WH.jpg differ diff --git a/atri/WH1.jpg b/atri/WH1.jpg new file mode 100644 index 00000000..bee54b79 Binary files /dev/null and b/atri/WH1.jpg differ diff --git a/atri/WH2.jpg b/atri/WH2.jpg new file mode 100644 index 00000000..39145bef Binary files /dev/null and b/atri/WH2.jpg differ diff --git a/atri/WH3.jpg b/atri/WH3.jpg new file mode 100644 index 00000000..75dac64a Binary files /dev/null and b/atri/WH3.jpg differ diff --git a/atri/WQ.jpg b/atri/WQ.jpg new file mode 100644 index 00000000..2a4f25dd Binary files /dev/null and b/atri/WQ.jpg differ diff --git a/atri/WQ1.jpg b/atri/WQ1.jpg new file mode 100644 index 00000000..66f7eb36 Binary files /dev/null and b/atri/WQ1.jpg differ diff --git a/atri/YES.png b/atri/YES.png new file mode 100644 index 00000000..c6ebae37 Binary files /dev/null and b/atri/YES.png differ diff --git a/atri/atri.go b/atri/atri.go new file mode 100644 index 00000000..644dc2e1 --- /dev/null +++ b/atri/atri.go @@ -0,0 +1,226 @@ +// 本文件基于 https://github.com/Kyomotoi/ATRI +// 为 Golang 移植版,语料、素材均来自上述项目 +// 本项目遵守 AGPL v3 协议进行开源 +package atri + +import ( + "math/rand" + "time" + + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" +) + +var ( + PRIO = -1 + RES = "https://raw.dihe.moe/Yiwen-Chan/ZeroBot-Plugin/master/atri/" +) + +func init() { // 插件主体 + zero.OnKeywordGroup([]string{"萝卜子"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + ctx.SendChain(message.Text("萝卜子是对机器人的蔑称!", "是亚托莉......萝卜子可是对机器人的蔑称")) + }) + zero.OnKeywordGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, zero.OnlyToMe).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + if rand.Intn(10) == 0 { + ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.jpg")) + } + }) + zero.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, zero.OnlyToMe).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + if rand.Intn(10) == 0 { + ctx.SendChain(randImage("FN.jpg", "WQ.jpg", "WQ1.jpg")) + } + }) + zero.OnFullMatchGroup([]string{"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + now := time.Now().Hour() + switch { + case now < 6: // 凌晨 + ctx.SendChain(randText( + "zzzz......", + "zzzzzzzz......", + "zzz...好涩哦..zzz....", + "别...不要..zzz..那..zzz..", + "嘻嘻..zzz..呐~..zzzz..", + "...zzz....哧溜哧溜....", + )) + case now >= 6 && now < 9: + ctx.SendChain(randText( + "啊......早上好...(哈欠)", + "唔......吧唧...早上...哈啊啊~~~\n早上好......", + "早上好......", + "早上好呜......呼啊啊~~~~", + "啊......早上好。\n昨晚也很激情呢!", + "吧唧吧唧......怎么了...已经早上了么...", + "早上好!", + "......看起来像是傍晚,其实已经早上了吗?", + "早上好......欸~~~脸好近呢", + )) + case now >= 9 && now < 18: + ctx.SendChain(randText( + "哼!这个点还早啥,昨晚干啥去了!?", + "熬夜了对吧熬夜了对吧熬夜了对吧???!", + "是不是熬夜是不是熬夜是不是熬夜?!", + )) + case now >= 18 && now < 24: + ctx.SendChain(randText( + "早个啥?哼唧!我都准备洗洗睡了!", + "不是...你看看几点了,哼!", + "晚上好哇", + )) + } + }) + zero.OnFullMatchGroup([]string{"中午好", "午安"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + now := time.Now().Hour() + switch { + case now < 6: // 凌晨 + ctx.SendChain(randText( + "午安w", + "午觉要好好睡哦,ATRI会陪伴在你身旁的w", + "嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o", + "睡你午觉去!哼唧!!", + )) + } + }) + zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + now := time.Now().Hour() + switch { + case now < 6: // 凌晨 + ctx.SendChain(randText( + "zzzz......", + "zzzzzzzz......", + "zzz...好涩哦..zzz....", + "别...不要..zzz..那..zzz..", + "嘻嘻..zzz..呐~..zzzz..", + "...zzz....哧溜哧溜....", + )) + case now >= 6 && now < 11: + ctx.SendChain(randText( + "你可猝死算了吧!", + "?啊这", + "亲,这边建议赶快去睡觉呢~~~", + "不可忍不可忍不可忍!!为何这还不猝死!!", + )) + case now >= 11 && now < 15: + ctx.SendChain(randText( + "午安w", + "午觉要好好睡哦,ATRI会陪伴在你身旁的w", + "嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o", + "睡你午觉去!哼唧!!", + )) + case now >= 15 && now < 19: + ctx.SendChain(randText( + "难不成??晚上不想睡觉??现在休息", + "就......挺离谱的...现在睡觉", + "现在还是白天哦,睡觉还太早了", + )) + case now >= 19 && now < 24: + ctx.SendChain(randText( + "嗯哼哼~睡吧,就像平常一样安眠吧~o(≧▽≦)o", + "......(打瞌睡)", + "呼...呼...已经睡着了哦~...呼......", + "......我、我会在这守着你的,请务必好好睡着", + )) + } + }) + zero.OnKeywordGroup([]string{"高性能", "太棒了", "すごい", "sugoi", "斯国一", "よかった"}, zero.OnlyToMe).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + ctx.SendChain(randText( + "当然,我是高性能的嘛~!", + "小事一桩,我是高性能的嘛", + "怎么样?还是我比较高性能吧?", + "哼哼!我果然是高性能的呢!", + "因为我是高性能的嘛!嗯哼!", + "因为我是高性能的呢!", + "哎呀~,我可真是太高性能了", + "正是,因为我是高性能的", + "是的。我是高性能的嘛♪", + "毕竟我可是高性能的!", + "嘿嘿,我的高性能发挥出来啦♪", + "我果然是很高性能的机器人吧!", + "是吧!谁叫我这么高性能呢!哼哼!", + "交给我吧,有高性能的我陪着呢", + "呣......我的高性能,毫无遗憾地施展出来了......", + )) + }) + zero.OnKeywordGroup([]string{"没事", "没关系", "大丈夫", "还好", "不要紧", "没出大问题", "没伤到哪"}, zero.OnlyToMe).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + ctx.SendChain(randText( + "当然,我是高性能的嘛~!", + "没事没事,因为我是高性能的嘛!嗯哼!", + "没事的,因为我是高性能的呢!", + "正是,因为我是高性能的", + "是的。我是高性能的嘛♪", + "毕竟我可是高性能的!", + "那种程度的事不算什么的。\n别看我这样,我可是高性能的", + "没问题的,我可是高性能的", + )) + }) + + zero.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + if rand.Intn(3) == 0 { + ctx.SendChain(randImage("YES.jpg", "NO.jpg")) + } + }) + zero.OnFullMatchGroup([]string{"啊这"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + if rand.Intn(3) == 0 { + ctx.SendChain(randImage("AZ.jpg", "AZ1.jpg")) + } + }) + zero.OnFullMatchGroup([]string{"我好了"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + ctx.SendChain(randText("不许好!", "憋回去!")) + }) + zero.OnFullMatchGroup([]string{"?", "?", "¿"}).SetBlock(true).SetPriority(PRIO). + Handle(func(ctx *zero.Ctx) { + if now := time.Now().Hour(); now < 6 { + return + } + switch rand.Intn(5) { + case 0: + ctx.SendChain(randText("?", "?", "嗯?", "(。´・ω・)ん?", "ん?")) + case 1, 2: + ctx.SendChain(randImage("WH.jpg", "WH1.jpg", "WH2.jpg", "WH3.jpg")) + } + }) +} + +func randText(text ...string) message.MessageSegment { + length := len(text) + return message.Text(text[rand.Intn(length)]) +} + +func randImage(file ...string) message.MessageSegment { + length := len(file) + return message.Image(RES + file[rand.Intn(length)]) +} diff --git a/main.go b/main.go index 982af4be..a37179d1 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "github.com/wdvxdr1123/ZeroBot/driver" "github.com/wdvxdr1123/ZeroBot/message" + _ "github.com/Yiwen-Chan/ZeroBot-Plugin/atri" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/chat" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/github" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/manager" @@ -30,7 +31,7 @@ func main() { fmt.Print(` ====================[ZeroBot-Plugin]==================== * OneBot + ZeroBot + Golang -* Version 1.0.0 - 2021-04-18 21:52:10.261947 +0800 CST +* Version 1.0.1 - 2021-04-20 02:38:38.4181345 +0800 CST * Copyright © 2021 Kanri, DawnNights, All Rights Reserved * Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin ======================================================== @@ -48,7 +49,7 @@ func main() { Handle(func(ctx *zero.Ctx) { ctx.SendChain(message.Text( "* OneBot + ZeroBot + Golang ", "\n", - "* Version 1.0.0 - 2021-04-18 21:52:10.261947 +0800 CST", "\n", + "* Version 1.0.1 - 2021-04-20 02:38:38.4181345 +0800 CST", "\n", "* Copyright © 2021 Kanri, DawnNights, All Rights Reserved ", "\n", "* Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin", ))