package main import ( "fmt" "sort" "strings" ) type HelpPlugin struct{} func (p HelpPlugin) Name() string { return "help" } func (p HelpPlugin) ShortHelp() string { return "List commands or get help for a specific command" } func (p HelpPlugin) DetailedHelp() string { return "help [command]\n\nWith no arguments, lists all available commands.\nWith a command name, shows detailed help for that command.\n\nExamples:\n help\n help math" } func (p HelpPlugin) Execute(msg BotMessage, args string) string { if args == "" { names := make([]string, 0, len(registry)) for name := range registry { names = append(names, name) } sort.Strings(names) var sb strings.Builder for _, name := range names { fmt.Fprintf(&sb, "%s — %s\n", name, registry[name].ShortHelp()) } return sb.String() } if plugin, ok := registry[args]; ok { return plugin.DetailedHelp() } return fmt.Sprintf("No help found for '%s'. Try 'help' to see all commands.", args) }