command

package
v0.1.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "slack_command"
	CommandPort   = "command"
	ErrorPort     = "error"
	RequestPort   = "request"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Original request context
	ResponseURL string `json:"responseUrl" title:"Response URL" description:"URL to send delayed responses"`
	TriggerID   string `json:"triggerId" title:"Trigger ID" description:"ID for opening modals"`

	// Command details
	Command string   `json:"command" title:"Command" description:"The slash command used (e.g., /deploy)"`
	Text    string   `json:"text" title:"Text" description:"Text after the command"`
	Args    []string `json:"args" title:"Args" description:"Text split into arguments"`

	// User info
	UserID   string `json:"userId" title:"User ID" description:"Slack user ID"`
	UserName string `json:"userName" title:"User Name" description:"Slack username"`

	// Channel info
	ChannelID   string `json:"channelId" title:"Channel ID" description:"Channel where command was invoked"`
	ChannelName string `json:"channelName" title:"Channel Name" description:"Channel name"`

	// Team info
	TeamID     string `json:"teamId" title:"Team ID" description:"Slack workspace ID"`
	TeamDomain string `json:"teamDomain" title:"Team Domain" description:"Slack workspace domain"`

	// For routing
	Action    string   `json:"action" title:"Action" description:"First argument (e.g., 'status' from '/k8s status app')"`
	Target    string   `json:"target" title:"Target" description:"Second argument (e.g., 'app' from '/k8s status app')"`
	ExtraArgs []string `json:"extraArgs" title:"Extra Args" description:"Remaining arguments after action and target"`
}

Command is the parsed slash command

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component implements the Slack command receiver

func (*Component) GetInfo

func (c *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

func (c *Component) Handle(ctx context.Context, handler module.Handler, port string, msg any) any

func (*Component) Instance

func (c *Component) Instance() module.Component

func (*Component) Ports

func (c *Component) Ports() []module.Port

type Error

type Error struct {
	Error   string  `json:"error" title:"Error"`
	Request Request `json:"request" title:"Request"`
}

Error output

type Request

type Request struct {
	// HTTP headers needed for verification
	Headers map[string]string `json:"headers" title:"Headers" description:"HTTP headers from the request"`
	// Raw body for signature verification
	Body string `json:"body" required:"true" title:"Body" description:"Raw request body"`
}

Request is the incoming HTTP request from Slack

type Settings

type Settings struct {
	SigningSecret   string `` /* 141-byte string literal not displayed */
	EnableErrorPort bool   `json:"enableErrorPort" title:"Enable Error Port" description:"Output errors to error port instead of failing"`
	SkipVerify      bool   `json:"skipVerify" title:"Skip Verification" description:"Skip signature verification (for testing only)"`
}

Settings configures the component

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL