Files
bl/modules/config/controller/robot/egg.go
xinian f8b8a87331
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
fix: 修复日志输出与代码格式错误
2026-03-25 01:22:44 +08:00

42 lines
924 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"
zero "github.com/wdvxdr1123/ZeroBot"
)
func init() {
zero.OnCommand("繁殖").
Handle(func(ctx *zero.Ctx) {
var cdks []string
for _, v := range service.NewEggService().All() {
var buf strings.Builder
buf.WriteString("\n父亲")
for _, v := range v.FemalePetIDs {
buf.WriteString(xmlres.PetMAP[int(v)].DefName + "|")
}
buf.WriteString("母亲:")
for _, v := range v.MalePetIDs {
buf.WriteString(xmlres.PetMAP[int(v)].DefName + "|")
}
buf.WriteString("子代:")
for _, v := range v.OutputMons {
buf.WriteString(xmlres.PetMAP[int(v)].DefName + "|")
}
cdks = append(cdks, buf.String())
}
msg := ctx.Send(strings.Join(cdks, "\n"))
cool.Cron.AfterFunc(10*time.Second, func() {
ctx.DeleteMessage(msg)
})
})
}