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
2014-06-07 20:57:51 -07:00

29 lines
539 B
Go

package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/api"
)
func Hello(params map[string]interface{}) string {
name := params["name"].(string)
return fmt.Sprintf("hi %v", name)
}
func main() {
master := gobot.NewGobot()
server := api.NewApi(master)
server.Username = "gort"
server.Password = "klatuu"
server.Start()
hello := gobot.NewRobot("hello", nil, nil, nil)
hello.Commands = map[string]interface{}{"Hello": Hello}
master.Robots = append(master.Robots, hello)
master.Start()
}