mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-02 22:17:12 +08:00
25 lines
469 B
Go
25 lines
469 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/hybridgroup/gobot"
|
|
"github.com/hybridgroup/gobot/api"
|
|
)
|
|
|
|
func Hello(params map[string]interface{}) string {
|
|
name := params["name"].(string)
|
|
return fmt.Sprintf("hi %v", name)
|
|
}
|
|
|
|
func main() {
|
|
master := gobot.GobotMaster()
|
|
api.NewApi(master).Start()
|
|
|
|
hello := gobot.NewRobot("hello", nil, nil, nil)
|
|
hello.Commands = map[string]interface{}{"Hello": Hello}
|
|
|
|
master.Robots = append(master.Robots, hello)
|
|
|
|
master.Start()
|
|
}
|