增加 ATRI 模块

This commit is contained in:
Yiwen-Chan 2021-04-20 02:39:06 +08:00
parent 3275eab800
commit 392d2f1911
17 changed files with 233 additions and 3 deletions

View File

@ -90,10 +90,13 @@
5. 双击点击 build.bat 文件 5. 双击点击 build.bat 文件
6. 运行框架,并同时运行本插件 6. 运行框架,并同时运行本插件
#### 利用 Actions 编译 (推荐) #### 利用 Actions 在线编译 (推荐)
1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库 1. 点击右上角 Fork 本项目,并转跳到自己 Fork 的仓库
2. 点击仓库上方的 Actions 按钮,确认使用 Actions 2. 点击仓库上方的 Actions 按钮,确认使用 Actions
3. 编辑 main.go 文件,内容按需修改,返回仓库 3. 编辑 main.go 文件,内容按需修改,返回仓库
4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件 4. 点击 Actions 按钮,等待编译完成,在 Actions 里下载编译好的文件
5. 运行框架,并同时运行本插件 5. 运行框架,并同时运行本插件
### 特别感谢
- [ZeroBot](https://github.com/wdvxdr1123/ZeroBot)
- [ATRI](https://github.com/Kyomotoi/ATRI)

BIN
atri/AZ.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
atri/AZ1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
atri/FN.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
atri/NO.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
atri/SUKI.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
atri/SUKI1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
atri/SUKI2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 KiB

BIN
atri/WH.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
atri/WH1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
atri/WH2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
atri/WH3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
atri/WQ.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
atri/WQ1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
atri/YES.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

226
atri/atri.go Normal file
View File

@ -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)])
}

View File

@ -9,6 +9,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/driver" "github.com/wdvxdr1123/ZeroBot/driver"
"github.com/wdvxdr1123/ZeroBot/message" "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/chat"
_ "github.com/Yiwen-Chan/ZeroBot-Plugin/github" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/github"
_ "github.com/Yiwen-Chan/ZeroBot-Plugin/manager" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/manager"
@ -30,7 +31,7 @@ func main() {
fmt.Print(` fmt.Print(`
====================[ZeroBot-Plugin]==================== ====================[ZeroBot-Plugin]====================
* OneBot + ZeroBot + Golang * 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 * Copyright © 2021 Kanri, DawnNights, All Rights Reserved
* Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin * Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin
======================================================== ========================================================
@ -48,7 +49,7 @@ func main() {
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text( ctx.SendChain(message.Text(
"* OneBot + ZeroBot + Golang ", "\n", "* 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", "* Copyright © 2021 Kanri, DawnNights, All Rights Reserved ", "\n",
"* Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin", "* Project: https://github.com/Yiwen-Chan/ZeroBot-Plugin",
)) ))