Files
bl/modules/config/controller/robot/fusion.go
xinian 6702649cac
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
fix: 修正消息清理逻辑
2026-03-25 03:13:06 +08:00

42 lines
1016 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package robot
import (
"blazing/common/data/xmlres"
"blazing/cool"
"blazing/modules/config/service"
"strings"
"time"
"github.com/gogf/gf/v2/util/gconv"
zero "github.com/wdvxdr1123/ZeroBot"
)
func init() {
zero.OnCommand("融合").
Handle(func(ctx *zero.Ctx) {
var cdks []string
for _, v := range service.NewPetFusionService().All() {
var buf strings.Builder
buf.WriteString("\n主")
buf.WriteString(xmlres.PetMAP[int(v.MainPetID)].DefName + "|")
buf.WriteString("副:")
for _, v := range v.SubPetIDs {
buf.WriteString(xmlres.PetMAP[int(v)].DefName + "|")
}
buf.WriteString("结果:")
buf.WriteString(xmlres.PetMAP[int(v.ResultPetID)].DefName + "|")
buf.WriteString("概率:")
buf.WriteString(gconv.String(v.Probability))
cdks = append(cdks, buf.String())
}
msg := ctx.Send(strings.Join(cdks, "\n"))
cool.Cron.AfterFunc(10*time.Second, func() {
ctx.DeleteMessage(ctx.Event.MessageID)
ctx.DeleteMessage(msg)
})
})
}