slack

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApp

func NewApp(config AppConfig) (spanner.App, error)

NewApp creates a new slack app.

botToken is the token for the bot user, with prefix 'xoxb-' appToken is the token for the app, with prefix 'xapp-'

Slack apps use socket mode to handle events, so the app will need to be configured to use socket mode. https://api.slack.com/apis/connections/socket

As at November 2023, this means that these apps cannot be distributed in the public Slack app directory.

func NewCustomEvent

func NewCustomEvent(body map[string]interface{}) spanner.CustomEvent

Types

type AppConfig added in v0.1.2

type AppConfig struct {
	BotToken string
	AppToken string
	Debug    bool

	// AckOnError acknowledges messages when there is an error performing actions to prevent
	// Slack from sending a retry. This will avoid actions being duplicated.
	AckOnError bool

	EventInterceptor   spanner.EventInterceptor
	HandlerInterceptor spanner.HandlerInterceptor
	ActionInterceptor  spanner.ActionInterceptor
	FinishInterceptor  spanner.FinishInterceptor
}

type BlockState

type BlockState struct {
	StringSlice []string `json:"ss,omitempty"`
	String      string   `json:"s,omitempty"`
	Int         int      `json:"i,omitempty"`
}

type Blocks

type Blocks struct {
	BlockStates map[string]BlockState `json:"block_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Blocks) Button

func (b *Blocks) Button(label string) bool

func (*Blocks) Divider

func (b *Blocks) Divider()

func (*Blocks) Header

func (b *Blocks) Header(message string)

func (*Blocks) Markdown

func (b *Blocks) Markdown(text string)

func (*Blocks) MultilineTextInput

func (b *Blocks) MultilineTextInput(label, hint, placeholder string) string

func (*Blocks) MultipleSelect

func (b *Blocks) MultipleSelect(title string, options []spanner.Option) []string

func (*Blocks) PlainText

func (b *Blocks) PlainText(text string)

func (*Blocks) Select

func (b *Blocks) Select(title string, options []spanner.Option) string

func (*Blocks) TextInput

func (b *Blocks) TextInput(label, hint, placeholder string) string

type MessageSender

type MessageSender struct {
	Messages   []*message `json:"messages"`
	EventDepth int        `json:"event_depth"`
	// contains filtered or unexported fields
}

func (*MessageSender) SendMessage

func (m *MessageSender) SendMessage(channelID string) spanner.Message

Jump to

Keyboard shortcuts

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