(new): command groups
Golang lint / lint (push) Successful in 1m9s

(refactor): command cloning
(tests): command groups
(doc): changelog
This commit is contained in:
2026-04-30 11:19:46 +03:00
parent b123709f28
commit 269ccec007
6 changed files with 355 additions and 178 deletions
+18
View File
@@ -2,6 +2,7 @@ package laniakea
import (
"encoding/json"
"maps"
"sync"
)
@@ -111,6 +112,23 @@ func (s *Scene[T]) executeMessage(ctx *SceneContext, db T) (SceneResult, bool, e
return result, true, err
}
func (s *Scene[T]) clone() *Scene[T] {
if s == nil {
return nil
}
cloned := *s
cloned.steps = make(map[string]SceneHandler[T], len(s.steps))
cloned.commands = make(map[string]SceneHandler[T], len(s.commands))
cloned.payloads = make(map[string]SceneHandler[T], len(s.payloads))
maps.Copy(cloned.steps, s.steps)
maps.Copy(cloned.commands, s.commands)
maps.Copy(cloned.payloads, s.payloads)
return &cloned
}
// SceneSession stores the active scene state for one session key.
type SceneSession struct {
// Scene is the registered scene name for the active session.