1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
hybridgroup.gobot/examples/hello_api_auth.go

27 lines
504 B
Go
Raw Normal View History

2014-04-18 15:45:42 -07:00
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
2014-05-22 20:18:45 -07:00
"github.com/hybridgroup/gobot/api"
2014-04-18 15:45:42 -07:00
)
func main() {
2014-06-07 20:57:51 -07:00
master := gobot.NewGobot()
2014-04-18 15:45:42 -07:00
2014-06-10 15:16:11 -07:00
server := api.NewAPI(master)
2014-05-22 20:18:45 -07:00
server.Username = "gort"
server.Password = "klatuu"
server.Start()
hello := gobot.NewRobot("hello", nil, nil, nil)
2014-06-11 16:44:23 -07:00
hello.AddCommand("HiThere", func(params map[string]interface{}) interface{} {
return []string{fmt.Sprintf("Hey"), fmt.Sprintf("dude!")}
})
2014-04-18 15:45:42 -07:00
master.Robots = append(master.Robots, hello)
master.Start()
}