mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
27 lines
504 B
Go
27 lines
504 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/hybridgroup/gobot"
|
|
"github.com/hybridgroup/gobot/api"
|
|
)
|
|
|
|
func main() {
|
|
master := gobot.NewGobot()
|
|
|
|
server := api.NewAPI(master)
|
|
server.Username = "gort"
|
|
server.Password = "klatuu"
|
|
server.Start()
|
|
|
|
hello := gobot.NewRobot("hello", nil, nil, nil)
|
|
|
|
hello.AddCommand("HiThere", func(params map[string]interface{}) interface{} {
|
|
return []string{fmt.Sprintf("Hey"), fmt.Sprintf("dude!")}
|
|
})
|
|
|
|
master.Robots = append(master.Robots, hello)
|
|
|
|
master.Start()
|
|
}
|