feat: 添加野怪查询指令及支持服务
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
41
modules/config/controller/robot/mappit.go
Normal file
41
modules/config/controller/robot/mappit.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package robot
|
||||
|
||||
import (
|
||||
"blazing/modules/config/service"
|
||||
dict "blazing/modules/dict/service"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
)
|
||||
|
||||
func init() {
|
||||
zero.OnCommand("野怪").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
msgs := strings.Fields(ctx.Event.Message.String())
|
||||
maps := dict.NewDictInfoService().GetData("mapid")
|
||||
pets := dict.NewDictInfoService().GetNameData("pet")
|
||||
|
||||
if len(msgs) > 1 {
|
||||
var count uint32 = 0
|
||||
t, ok := pets[msgs[1]]
|
||||
if ok {
|
||||
count = uint32(t.Value)
|
||||
} else {
|
||||
count = gconv.Uint32(msgs[1])
|
||||
}
|
||||
if count != 0 {
|
||||
var cdks []string
|
||||
for _, v := range service.NewMapPitService().GetPet(count) {
|
||||
|
||||
cdks = append(cdks, gconv.String(maps[uint32(v.MapID)].Name))
|
||||
|
||||
}
|
||||
|
||||
ctx.Send(strings.Join(cdks, "\n"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user