scene

package
v0.2.5-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorIsNotRegexMatcher              = errors.New("this matcher is not regex, but you try get regex matcher")
	ErrorIsNotSelectsMatcher            = errors.New("this matcher is not selects, but you try get selects matcher")
	ErrorEmptyNextSceneWithInfoScene    = errors.New("if scene is info scene use only flag NextScene")
	ErrorEmptyNextScenesWithNoInfoScene = errors.New("if scene is not info scene use only flag NextScenes")
	ErrorTooManyFields                  = errors.New("too many fields were passed to the matcher")
	ErrorUnknownTypeOfValue             = errors.New("the type of values is not supported. Supported type is:" +
		types.GetSupportTypes())
	ErrorNotFoundValueInText    = errors.New("settled value is not found in the text")
	ErrorNotSupportedMatherType = errors.New("the matcher name is not supported. Supported matchers is: " +
		strings.Join(matchers.GetSupportedNames(), ", "))
	ErrorNotFoundToSceneInMather = errors.New("not found scene that was bee settled in the matcher. " +
		"The name of the scene must be specified in the nextScene field of the current scene")
	ErrorNotFoundToSceneInButton = errors.New("not found scene that was bee settled in the button. " +
		"The name of the scene must be specified in the nextScene field of the current scene")
	ErrorNotSupportedErrorType = errors.New("the base error name is not supported. Supported base errors is: " +
		strings.Join(errors2.GetSupportedNames(), ", "))
)

Functions

This section is empty.

Types

type Button

type Button struct {
	Text    string  `yaml:"text" xml:"text" json:"text"`
	URL     string  `yaml:"url,omitempty" xml:"url,omitempty" json:"url,omitempty"`
	Payload Payload `yaml:"payload,omitempty" json:"payload,omitempty" xml:"payload,omitempty"`
	ToScene string  `yaml:"toScene,omitempty" json:"to_scene,omitempty" xml:"toScene,omitempty"`
}

type Context

type Context struct {
	SaveValue *SaveValue  `yaml:"saveValue" json:"save_value" xml:"saveValue"`
	LoadValue []LoadValue `yaml:"loadValue" json:"load_value" xml:"loadValue"`
}

type Error

type Error struct {
	Base  string `yaml:"base,omitempty" json:"base,omitempty" xml:"base,omitempty"`
	Name  string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	Text  string `yaml:"text,omitempty" json:"text,omitempty" xml:"text,omitempty"`
	Scene string `yaml:"scene,omitempty" json:"scene,omitempty" xml:"scene,omitempty"`
}

func (Error) IsBase

func (e Error) IsBase() bool

func (Error) IsScene

func (e Error) IsScene() bool

func (Error) IsText

func (e Error) IsText() bool

func (Error) IsValid

func (e Error) IsValid() bool

type GoodByeScene

type GoodByeScene struct {
	Scene
	Name string `yaml:"name" json:"name" xml:"name"`
}

type LoadValue

type LoadValue struct {
	Name string
	Type string
}

func (*LoadValue) UnmarshalJSON

func (lv *LoadValue) UnmarshalJSON(bs []byte) error

func (*LoadValue) UnmarshalXML

func (lv *LoadValue) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*LoadValue) UnmarshalYAML

func (lv *LoadValue) UnmarshalYAML(un func(interface{}) error) (err error)

type Matcher

type Matcher struct {
	Name    string
	ToScene string
}

func (*Matcher) UnmarshalJSON

func (m *Matcher) UnmarshalJSON(bs []byte) error

func (*Matcher) UnmarshalXML

func (m *Matcher) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Matcher) UnmarshalYAML

func (m *Matcher) UnmarshalYAML(un func(interface{}) error) (err error)

type Payload

type Payload interface{}

type RegexMatcher

type RegexMatcher struct {
	Name        string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	Regex       string `yaml:"regex" json:"regex" xml:"regex"`
	NameMatched string `yaml:"nameMatched" json:"name_matched" xml:"nameMatched"`
}

type SaveValue

type SaveValue struct {
	Name string `yaml:"name" json:"name" xml:"name"`
	Type string `yaml:"type" json:"type" xml:"type"`
}

type Scene

type Scene struct {
	IsEnd       bool              `yaml:"isEnd,omitempty" json:"is_end,omitempty" xml:"isEnd,omitempty"`
	IsInfoScene bool              `yaml:"isInfoScene,omitempty" json:"is_info_scene,omitempty" xml:"isInfoScene,omitempty"`
	NextScene   string            `yaml:"nextScene,omitempty" json:"next_scene,omitempty" xml:"nextScene,omitempty"`
	Text        Text              `yaml:"text" json:"text" xml:"text"`
	Error       Error             `yaml:"error,omitempty" json:"error,omitempty" xml:"error,omitempty"`
	Context     Context           `yaml:"context" json:"context" xml:"context"`
	NextScenes  []string          `yaml:"nextScenes,omitempty" json:"next_scenes,omitempty" xml:"nextScenes,omitempty"`
	Matchers    []Matcher         `yaml:"matchers,omitempty" json:"matchers,omitempty" xml:"matchers,omitempty"`
	Buttons     map[string]Button `yaml:"buttons,omitempty" json:"buttons,omitempty" xml:"buttons,omitempty"`
}

func (*Scene) IsValid

func (s *Scene) IsValid(userMatchers map[string]ScriptMatcher) (bool, error)

type ScriptMatcher

type ScriptMatcher struct {
	// contains filtered or unexported fields
}

func (*ScriptMatcher) GetRegexMatcher

func (m *ScriptMatcher) GetRegexMatcher() (*RegexMatcher, error)

func (*ScriptMatcher) GetSelectsMatcher

func (m *ScriptMatcher) GetSelectsMatcher() (*SelectMatcher, error)

func (*ScriptMatcher) IsRegexMatcher

func (m *ScriptMatcher) IsRegexMatcher() bool

func (*ScriptMatcher) IsSelectMatcher

func (m *ScriptMatcher) IsSelectMatcher() bool

func (*ScriptMatcher) MustRegexMatcher

func (m *ScriptMatcher) MustRegexMatcher() RegexMatcher

func (*ScriptMatcher) MustSelectsMatcher

func (m *ScriptMatcher) MustSelectsMatcher() SelectMatcher

func (*ScriptMatcher) SetName

func (m *ScriptMatcher) SetName(name string)

func (*ScriptMatcher) UnmarshalJSON

func (m *ScriptMatcher) UnmarshalJSON(bs []byte) error

func (*ScriptMatcher) UnmarshalXML

func (m *ScriptMatcher) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*ScriptMatcher) UnmarshalYAML

func (m *ScriptMatcher) UnmarshalYAML(un func(interface{}) error) (err error)

type SelectMatcher

type SelectMatcher struct {
	Name           string   `yaml:"name" json:"name" xml:"name"`
	Selects        []string `yaml:"selects" json:"selects" xml:"selects"`
	ReplaceMessage string   `yaml:"replaceMessage" json:"replace_message" xml:"replaceMessage"`
}

type Text

type Text struct {
	Text   string           `yaml:"text" json:"text" xml:"text"`
	TTS    string           `yaml:"tts" json:"tts" xml:"tts"`
	Values map[string]Value `yaml:"values,omitempty" json:"values,omitempty" xml:"values,omitempty"`
}

func (*Text) IsValid

func (t *Text) IsValid() (bool, error)

type Value

type Value struct {
	Type        string
	FromContext string
}

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(bs []byte) error

func (*Value) UnmarshalXML

func (v *Value) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Value) UnmarshalYAML

func (v *Value) UnmarshalYAML(un func(interface{}) error) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL