-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
54 lines (49 loc) · 1.68 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package action
import (
"math/rand"
"time"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/MoYoez/Lucy_reibot/utils/ctxext"
"github.com/MoYoez/Lucy_reibot/utils/toolchain"
rei "github.com/fumiama/ReiBot"
tgba "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
)
var (
limit = rate.NewManager[int64](time.Minute*10, 15)
LucyImg = "/root/Lucy_Project/memes/" // LucyImg for Lucy的meme表情包地址
)
func init() {
engine := rei.Register("action", &ctrl.Options[*rei.Ctx]{
DisableOnDefault: false,
Help: "Lucy容易被动触发语言\n",
})
engine.OnMessageFullMatchGroup([]string{"喵", "喵喵", "喵喵喵"}).SetBlock(true).Handle(func(ctx *rei.Ctx) {
if !limit.Load(toolchain.GetThisGroupID(ctx)).Acquire() {
return
}
switch rand.Intn(6) {
case 2, 3:
ctx.SendPhoto(tgba.FilePath(RandImage("6152277811454.jpg", "meow.jpg", "file_3491851.jpg", "file_3492320.jpg")), true, "")
case 4, 5:
ctx.SendPlainMessage(true, []string{"喵喵~", "喵w~"}[rand.Intn(2)])
}
})
engine.OnMessageFullMatch("咕咕").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *rei.Ctx) {
if !limit.Load(toolchain.GetThisGroupID(ctx)).Acquire() {
return
}
ctx.SendPlainMessage(true, []string{"炖了~鸽子都要恰掉w", "咕咕咕", "不许咕咕咕"}[rand.Intn(3)])
})
engine.OnMessageKeyword("小情侣").SetBlock(true).Limit(ctxext.LimitByGroup).Handle(func(ctx *rei.Ctx) {
if !limit.Load(toolchain.GetThisGroupID(ctx)).Acquire() {
return
}
if rand.Intn(2) == 1 {
ctx.SendPlainMessage(true, "唉,小情侣")
}
})
}
func RandImage(file ...string) string {
return LucyImg + file[rand.Intn(len(file))]
}