Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
barrowkwan opened this issue Jun 23, 2018 · 1 comment
Open

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

barrowkwan opened this issue Jun 23, 2018 · 1 comment
Labels

Comments

@barrowkwan
Copy link

barrowkwan commented Jun 23, 2018

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()
}
@deadprogram
Copy link
Member

Hello @barrowkwan I believe you have run into hybridgroup/robeaux#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants