1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00

24 lines
539 B
Go
Raw Normal View History

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-06-12 20:58:54 -07:00
gbot.AddCommand("CustomGobotCommand", func(params map[string]interface{}) interface{} {
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-06-11 16:44:23 -07:00
hello.AddCommand("HiThere", 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
}