mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
ab82a72639
Add 9 new command groups (/model, /memory, /search, /browser, /usage, /email, /heartbeat, /skill, /fs) and improve existing commands by hiding internal UUIDs, resolving IDs to human-readable names in /settings, and switching /schedule to name-based references.
32 lines
784 B
Go
32 lines
784 B
Go
package command
|
|
|
|
func (h *Handler) buildSkillGroup() *CommandGroup {
|
|
g := newCommandGroup("skill", "View bot skills")
|
|
g.DefaultAction = "list"
|
|
g.Register(SubCommand{
|
|
Name: "list",
|
|
Usage: "list - List all skills",
|
|
Handler: func(cc CommandContext) (string, error) {
|
|
if h.skillLoader == nil {
|
|
return "Skill loading is not available.", nil
|
|
}
|
|
items, err := h.skillLoader.LoadSkills(cc.Ctx, cc.BotID)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if len(items) == 0 {
|
|
return "No skills found.", nil
|
|
}
|
|
records := make([][]kv, 0, len(items))
|
|
for _, item := range items {
|
|
records = append(records, []kv{
|
|
{"Name", item.Name},
|
|
{"Description", truncate(item.Description, 60)},
|
|
})
|
|
}
|
|
return formatItems(records), nil
|
|
},
|
|
})
|
|
return g
|
|
}
|