-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlifecycle.go
More file actions
48 lines (42 loc) · 1.25 KB
/
lifecycle.go
File metadata and controls
48 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package GoBot
type GoBotLifecycle struct {
ActiveStory string
ActiceStoryType string
ActiceNextStoryType string
ActiveChoiceValue string
ActiveChoice GoBotChoice
NextStory string
ActiveFormIds []string
ActiveForm GoBotForm
ActiveInput GoBotInput
ActiveInputValue string
ActiveCounter int
SavedResults map[string]interface{}
}
func NewLifecycle() *GoBotLifecycle {
return &GoBotLifecycle{
SavedResults: make(map[string]interface{}),
}
}
func (goBotLifecycle *GoBotLifecycle) SetState(state string, storyType string) {
goBotLifecycle.ActiveStory = state
goBotLifecycle.ActiceStoryType = storyType
}
func (goBotLifecycle *GoBotLifecycle) SetNextStory(nextStory string, storyType string) {
goBotLifecycle.NextStory = nextStory
goBotLifecycle.ActiceNextStoryType = storyType
}
func (goBotLifecycle *GoBotLifecycle) GetNextStory() (string, string) {
if goBotLifecycle.NextStory != "" {
return goBotLifecycle.NextStory, goBotLifecycle.ActiceNextStoryType
} else {
return "", ""
}
}
func (goBotLifecycle *GoBotLifecycle) GetState() (string, string) {
if goBotLifecycle.ActiveStory != "" {
return goBotLifecycle.ActiveStory, goBotLifecycle.ActiceStoryType
} else {
return "", ""
}
}