sox/plugin.go
Waldo 0b2e83ba0c Fix test isolation bug and refactor command handling into plugins
Use unique user in unknown command test to avoid last-command fallback
interference. Add plugin architecture with registered commands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 21:27:53 -07:00

27 lines
524 B
Go

package main
import "strings"
type Plugin interface {
Name() string
ShortHelp() string
DetailedHelp() string
Execute(msg BotMessage, args string) string
}
var registry = map[string]Plugin{}
func registerPlugin(p Plugin) {
registry[p.Name()] = p
}
func SplitFirstWord(input string) (firstWord string, restOfString string) {
words := strings.Fields(input)
if len(words) == 0 {
return "", ""
}
firstWord = words[0]
restOfString = strings.Join(words[1:], " ")
return strings.ToLower(firstWord), restOfString
}