mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
🐛 修复昵称下标越界
This commit is contained in:
parent
c26b7eaf4d
commit
639c60ac86
13
chat/chat.go
13
chat/chat.go
@ -12,32 +12,33 @@ import (
|
||||
var poke = rate.NewManager(time.Minute*5, 8) // 戳一戳
|
||||
|
||||
func init() { // 插件主体
|
||||
var NICKNAME = zero.BotConfig.NickName[0]
|
||||
// 被喊名字
|
||||
zero.OnFullMatchGroup(zero.BotConfig.NickName).SetBlock(false).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var nickname = zero.BotConfig.NickName[0]
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(message.Text(
|
||||
[]string{
|
||||
NICKNAME + "在此,有何贵干~",
|
||||
nickname + "在此,有何贵干~",
|
||||
"(っ●ω●)っ在~",
|
||||
"这里是" + NICKNAME + "(っ●ω●)っ",
|
||||
NICKNAME + "不在呢~",
|
||||
"这里是" + nickname + "(っ●ω●)っ",
|
||||
nickname + "不在呢~",
|
||||
}[rand.Intn(4)],
|
||||
))
|
||||
})
|
||||
// 戳一戳
|
||||
zero.On("notice/notify/poke", zero.OnlyToMe).SetBlock(false).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
var nickname = zero.BotConfig.NickName[0]
|
||||
switch {
|
||||
case poke.Load(ctx.Event.UserID).AcquireN(3):
|
||||
// 5分钟共8块命令牌 一次消耗3块命令牌
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(message.Text("请不要戳", NICKNAME, " >_<"))
|
||||
ctx.SendChain(message.Text("请不要戳", nickname, " >_<"))
|
||||
case poke.Load(ctx.Event.UserID).Acquire():
|
||||
// 5分钟共8块命令牌 一次消耗1块命令牌
|
||||
time.Sleep(time.Second * 1)
|
||||
ctx.SendChain(message.Text("喂(#`O′) 戳", NICKNAME, "干嘛!"))
|
||||
ctx.SendChain(message.Text("喂(#`O′) 戳", nickname, "干嘛!"))
|
||||
default:
|
||||
// 频繁触发,不回复
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user