Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/autom8ter/cobraslack

create a slack slash command handler that executes a cobra command
https://github.com/autom8ter/cobraslack

cobra golang slack slack-bot

Last synced: about 18 hours ago
JSON representation

create a slack slash command handler that executes a cobra command

Awesome Lists containing this project

README

        

# cobraslack
--
import "."

## Usage

#### func QueryHandler

```go
func QueryHandler(cmd *cobra.Command) http.HandlerFunc
```
QueryHandler returns an http handler that sets the arguments to the root cobra
command from the text of the 'text' query paramater the output of the cobra
command is written directly to the response body. example executing "echo -h"
subcommand: curl -X GET "$(host)/command?text=echo%20-h"

#### func SlackHandler

```go
func SlackHandler(cmd *cobra.Command, verificationToken string) http.HandlerFunc
```
SlackHandler returns an http handler that sets the arguments to the root cobra
command from the text of the slash command the output of the cobra command is
written directly to the response body as a slack message. example executing
"echo -h" subcommand: curl -X POST "$(host)/command" --data "text=echo -h"