1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-29 13:49:14 +08:00
Adrian Zankich 244ec0a0cf fmt examples
2014-07-10 17:21:21 -07:00

26 lines
546 B
Go

package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/api"
)
func main() {
gbot := gobot.NewGobot()
api.NewAPI(gbot).Start()
gbot.AddCommand("custom_gobot_command", func(params map[string]interface{}) interface{} {
return "This command is attached to the master!"
})
hello := gbot.AddRobot(gobot.NewRobot("hello"))
hello.AddCommand("hi_there", func(params map[string]interface{}) interface{} {
return fmt.Sprintf("This command is attached to the robot %v", hello.Name())
})
gbot.Start()
}