0

I've been working on setting up a Google Chat App that produces a dialog to users when a command is invoked and then from that dialog based on the text entered it should produce a card into the thread that it originated from. That part seems to be passing in my code however I'm stuck on where to add the "cards_v2" type functionality within the code. There are several files for this bot, this one pertains to the actual command for the bot I'm unsure if this should be added here somewhere or if it should go within my MessageRouter.go code

package bot

import (
    "encoding/json"
    "log"
    "net/http"

    chat "google.golang.org/api/chat/v1"
)

// DwnCommand News the URL to the current thread
type DwnCommand struct {
    Event  ChatEvent
    Writer http.ResponseWriter
}

// Help Returns detailed help about the command
func (a DwnCommand) Help() string {
    return a.Synopsis() + "\nUsage: new --help"
}

// Synopsis Returns a simple message about the command
func (a DwnCommand) Synopsis() string {
    return "A list of resources that one can create."
}

// Run Runs the dwn command.
func (a DwnCommand) Run(args []string) int {
    // Create Form Action
    form := &chat.OpenLink{
        Type: "FORM",
        Parameters: []*chat.OpenLinkParameter{
            {
                DisplayName: "Field 1",
                Name: "field1",
                Required: true,
            },
            {
                DisplayName: "Field 2",
                Name: "field2",
                Required: true,
            },
            {
                DisplayName: "Field 3",
                Name: "field3",
                Required: true,
            },
        },
    }
    writeNewMessage(a.Writer, "Please fill in the dialog", form)
    return 0
}

0 Answers0