Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶ added in v0.6.4
type Event struct { If interface{} `json:",omitempty"` Flags []string `json:",omitempty"` Speak struct { Format string Args ggja.BareArr } }
func (*Event) Text ¶ added in v0.6.4
Example ¶
package main import ( "encoding/json" "fmt" "log" "git.fractalqb.de/fractalqb/ggja" ) func must(err error) { if err != nil { log.Panic(err) } } func main() { var evt = Event{ If: [][]interface{}{ []interface{}{ ggja.BareObj{ "Chan": "npc", }, }, }, } evt.Speak.Format = "From \"%s\": %s" evt.Speak.Args = ggja.BareArr{ "From", ggja.BareArr{"Message_Localised", "Message"}, } jevt := make(ggja.BareObj) must(json.Unmarshal([]byte(`{ "From": "John Doe", "Message": "RoC Commander, o7!" }`), &jevt)) txt := evt.Text(ggja.Obj{Bare: jevt}) fmt.Println(txt) }
Output: From "John Doe": RoC Commander, o7!
type Speaker ¶
type Speaker struct { Exe string Args []string `json:",omitempty"` Verbose bool `json:",omitempty"` Events map[string]*Event }
func (*Speaker) OnJournalEvent ¶ added in v0.6.4
func (spk *Speaker) OnJournalEvent(e watched.JounalEvent) (err error)
func (*Speaker) OnStatusEvent ¶ added in v0.6.4
func (spk *Speaker) OnStatusEvent(e watched.StatusEvent) error
Click to show internal directories.
Click to hide internal directories.