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