feat: Implement core voicebot functionality with TeamSpeak 3 and xAI integration.

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-16 10:39:27 +01:00
parent aa8c0dbcbc
commit fb17813dcb
10 changed files with 460 additions and 287 deletions

View File

@@ -23,6 +23,31 @@ func ParseCommand(data []byte) (string, map[string]string) {
return cmd, args
}
// ParseCommands parses response that may contain multiple items separated by pipe (|)
func ParseCommands(data []byte) []*Command {
s := string(data)
// TS3 uses pipe | to separate list items
items := strings.Split(s, "|")
cmds := make([]*Command, 0, len(items))
// First item contains the command name
name, args := ParseCommand([]byte(items[0]))
cmds = append(cmds, &Command{Name: name, Params: args})
// Subsequent items reuse the same command name
for _, item := range items[1:] {
// Hack: Prepend command name to reuse ParseCommand logic
// or better: manually parse args.
// Since ParseCommand splits by space, we can just use "DUMMY " + item
// ensuring we trim properly.
_, itemArgs := ParseCommand([]byte("CMD " + strings.TrimSpace(item)))
cmds = append(cmds, &Command{Name: name, Params: itemArgs})
}
return cmds
}
// Unescape TS3 string
func Unescape(s string) string {
r := strings.NewReplacer(