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