2013-11-27 20:05:45 -08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/hybridgroup/gobot"
|
2014-05-22 20:18:45 -07:00
|
|
|
"github.com/hybridgroup/gobot/api"
|
2013-11-27 20:05:45 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func Hello(params map[string]interface{}) string {
|
|
|
|
name := params["name"].(string)
|
|
|
|
return fmt.Sprintf("hi %v", name)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2014-06-07 20:57:51 -07:00
|
|
|
master := gobot.NewGobot()
|
2014-06-10 15:16:11 -07:00
|
|
|
api.NewAPI(master).Start()
|
2013-11-27 20:05:45 -08:00
|
|
|
|
2014-05-22 20:18:45 -07:00
|
|
|
hello := gobot.NewRobot("hello", nil, nil, nil)
|
2013-11-27 20:05:45 -08:00
|
|
|
hello.Commands = map[string]interface{}{"Hello": Hello}
|
|
|
|
|
2014-04-16 15:54:39 -07:00
|
|
|
master.Robots = append(master.Robots, hello)
|
2013-11-27 20:05:45 -08:00
|
|
|
|
|
|
|
master.Start()
|
|
|
|
}
|