gobot icon indicating copy to clipboard operation
gobot copied to clipboard

Robeaux Key/Value didn't pass back to the backend

Open barrowkwan opened this issue 6 years ago • 1 comments

I don't know if it is Robeaux issue or if I missed something. I modify the hello_api_auth example, go to localhost:3000, add key/value and hit RUN, the key/value didn't seem to pass back to hello_api_auth. I have modified "hello.AddCommand" block to check what does "params" contain but it return "map[]"

package main

import (
        "fmt"
        "html"
        "net/http"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/api"
)

func main() {
        master := gobot.NewMaster()

        a := api.NewAPI(master)
        a.AddHandler(api.BasicAuth("gort", "klatuu"))
        a.Debug()

        a.AddHandler(func(w http.ResponseWriter, r *http.Request) {
                fmt.Fprintf(w, "Hello, %q \n", html.EscapeString(r.URL.Path))
        })
        a.Start()

        master.AddCommand("custom_gobot_command",
                func(params map[string]interface{}) interface{} {
                        return "This command is attached to the mcp!"
                })

        hello := master.AddRobot(gobot.NewRobot("hello"))

        hello.AddCommand("hi_there", func(params map[string]interface{}) interface{} {
                fmt.Println(params)
                return fmt.Sprintf("This command is attached to the robot %v", hello.Name)
        })

        master.Start()
}

barrowkwan avatar Jun 23 '18 08:06 barrowkwan

Hello @barrowkwan I believe you have run into https://github.com/hybridgroup/robeaux/issues/22

deadprogram avatar Jun 24 '18 15:06 deadprogram