feat(user): 用户名转换为小写并优化QQ绑定错误消息处理 - 在BindQQ方法中将用户名转换为小写以确保一致性 - 修改bindqq控制器中的错误消息发送方式,使用私信发送绑定结果 - 避免在群聊中显示敏感的绑定错误信息 refactor(robot): 优化扭蛋物品列表展示逻辑 - 引入samber/lo库用于数组去重操作
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
zero.OnCommand("CDK").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/samber/lo"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
@@ -15,15 +16,14 @@ func init() {
|
||||
zero.OnCommand("扭蛋物品").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
|
||||
var buf strings.Builder
|
||||
var buf []string
|
||||
|
||||
for _, v := range service.NewItemService().AllEgg() {
|
||||
|
||||
buf.WriteString(xmlres.ItemsMAP[int(v.ItemID)].Name + "\n")
|
||||
buf = append(buf, xmlres.ItemsMAP[int(v.ItemID)].Name)
|
||||
|
||||
}
|
||||
|
||||
msg := ctx.SendChain(message.At(ctx.Event.Sender.ID), message.Reply(ctx.Event.MessageID), message.Text(buf.String()))
|
||||
buf = lo.Union(buf)
|
||||
msg := ctx.SendChain(message.At(ctx.Event.Sender.ID), message.Reply(ctx.Event.MessageID), message.Text(strings.Join(buf, "\n")))
|
||||
cool.Cron.AfterFunc(30*time.Second, func() {
|
||||
ctx.DeleteMessage(ctx.Event.MessageID)
|
||||
ctx.DeleteMessage(msg)
|
||||
|
||||
Reference in New Issue
Block a user