Skip to content

Commit

Permalink
OEM FOR E2
Browse files Browse the repository at this point in the history
  • Loading branch information
vatebur committed Dec 3, 2024
1 parent efb44c0 commit c1c49e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugin/atri/atri.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package atri
import (
"encoding/base64"
"math/rand"
"os"
"time"

zero "github.com/wdvxdr1123/ZeroBot"
Expand All @@ -20,15 +21,19 @@ import (
type datagetter func(string, bool) ([]byte, error)

func (dgtr datagetter) randImage(file ...string) message.Segment {
data, err := dgtr(file[rand.Intn(len(file))], true)
// data, err := dgtr(file[rand.Intn(len(file))], true)
filePath := "data/Atri/" + file[rand.Intn(len(file))]
data, err := os.ReadFile(filePath)
if err != nil {
return message.Text("ERROR: ", err)
}
return message.ImageBytes(data)
}

func (dgtr datagetter) randRecord(file ...string) message.Segment {
data, err := dgtr(file[rand.Intn(len(file))], true)
// data, err := dgtr(file[rand.Intn(len(file))], true)
filePath := "data/Atri/" + file[rand.Intn(len(file))]
data, err := os.ReadFile(filePath)
if err != nil {
return message.Text("ERROR: ", err)
}
Expand Down Expand Up @@ -78,7 +83,7 @@ func init() { // 插件主体
})
engine.OnFullMatchGroup([]string{"喜欢", "爱你", "爱", "suki", "daisuki", "すき", "好き", "贴贴", "老婆", "亲一个", "mua"}, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
ctx.SendChain(dgtr.randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png"))
ctx.SendChain(dgtr.randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.jpg"))
})
engine.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, zero.OnlyToMe).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
Expand Down Expand Up @@ -214,7 +219,7 @@ func init() { // 插件主体
engine.OnKeywordGroup([]string{"好吗", "是吗", "行不行", "能不能", "可不可以"}).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
if rand.Intn(2) == 0 {
ctx.SendChain(dgtr.randImage("YES.png", "NO.jpg"))
ctx.SendChain(dgtr.randImage("YES.jpg", "NO.jpg"))
}
})
engine.OnKeywordGroup([]string{"啊这"}).SetBlock(true).
Expand Down

0 comments on commit c1c49e8

Please sign in to comment.