41 lines
905 B
Go
41 lines
905 B
Go
package robot
|
|
|
|
import (
|
|
"blazing/common/data/xmlres"
|
|
"blazing/modules/config/service"
|
|
"strings"
|
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
zero "github.com/wdvxdr1123/ZeroBot"
|
|
"github.com/wdvxdr1123/ZeroBot/message"
|
|
)
|
|
|
|
func init() {
|
|
zero.OnCommand("扭蛋物品").
|
|
Handle(func(ctx *zero.Ctx) {
|
|
|
|
msgs := strings.Fields(ctx.Event.Message.String())
|
|
count := 1
|
|
if len(msgs) > 1 {
|
|
count = gconv.Int(msgs[1])
|
|
|
|
}
|
|
if count > 10 {
|
|
count = 10
|
|
}
|
|
var rets []string
|
|
for _, v := range service.NewItemService().GetEgg(count) {
|
|
|
|
var buf strings.Builder
|
|
buf.WriteString(xmlres.ItemsMAP[int(v.ItemId)].Name)
|
|
buf.WriteString(": " + gconv.String(v.ItemCnt))
|
|
// 你想加什么格式自己加
|
|
rets = append(rets, buf.String())
|
|
|
|
}
|
|
|
|
ctx.SendChain(message.At(ctx.Event.Sender.ID), message.Reply(ctx.Event.MessageID), message.Text(strings.Join(rets, "\n")))
|
|
|
|
})
|
|
}
|