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 main() {
|
2014-06-12 20:58:54 -07:00
|
|
|
gbot := gobot.NewGobot()
|
|
|
|
api.NewAPI(gbot).Start()
|
2013-11-27 20:05:45 -08:00
|
|
|
|
2014-07-08 18:36:14 -07:00
|
|
|
gbot.AddCommand("custom_gobot_command", func(params map[string]interface{}) interface{} {
|
2014-06-12 20:58:54 -07:00
|
|
|
return "This command is attached to the master!"
|
|
|
|
})
|
2014-06-11 16:44:23 -07:00
|
|
|
|
2014-06-12 21:33:25 -07:00
|
|
|
hello := gbot.AddRobot(gobot.NewRobot("hello"))
|
2014-07-08 18:36:14 -07:00
|
|
|
|
|
|
|
hello.AddCommand("hi_there", func(params map[string]interface{}) interface{} {
|
2014-06-12 20:58:54 -07:00
|
|
|
return fmt.Sprintf("This command is attached to the robot %v", hello.Name)
|
2014-06-11 16:44:23 -07:00
|
|
|
})
|
2013-11-27 20:05:45 -08:00
|
|
|
|
2014-06-12 20:58:54 -07:00
|
|
|
gbot.Start()
|
2013-11-27 20:05:45 -08:00
|
|
|
}
|