slack

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Client             Client
	SocketClient       SocketClient
	SocketClientEvents chan socketmode.Event
	// contains filtered or unexported fields
}

Channel contains a Slack Channel

func New

func New(config Config) *Channel

New returns an initialized slack client

func (*Channel) ReceiveMessage

func (c *Channel) ReceiveMessage(body []byte) (*messages.Receive, error)

ReceiveMessage for Slack

func (*Channel) ReceiveMessages

func (c *Channel) ReceiveMessages(receiveChan chan messages.Receive)

ReceiveMessages uses event queues to receive messages. Starts a long running process

func (*Channel) SendMessage

func (c *Channel) SendMessage(response *messages.Response) error

SendMessage to Slack with the bots response

func (*Channel) String added in v0.6.2

func (c *Channel) String() string

func (*Channel) ValidateCallback added in v0.6.0

func (c *Channel) ValidateCallback(r *http.Request) bool

ValidateCallback validates a callback to the channel

type Client

type Client interface {
	PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
}

Client is the Slack client interface

type Config

type Config struct {
	Token    string        `mapstructure:"token"`
	AppToken string        `mapstructure:"app_token"`
	Delay    time.Duration `mapstructure:"delay"`
}

Config contains the Slack token

type ErrURLVerification

type ErrURLVerification struct {
	Challenge []byte
}

ErrURLVerification raised when an auth challenge is supposed to be performed

func (ErrURLVerification) Error

func (e ErrURLVerification) Error() string

type MessageIn

type MessageIn struct {
	Challenge string    `json:"challenge"`
	Type      string    `json:"type"`
	Event     slack.Msg `json:"event"`
	Token     string    `json:"token"`
}

MessageIn models a Slack message and/or Slack endpoint challenge

type SocketClient

type SocketClient interface {
	Ack(req socketmode.Request, payload ...interface{})
	Run() error
}

SocketClient is the Slack socketmode client interface

Directories

Path Synopsis
Package mockslack is a generated GoMock package.
Package mockslack is a generated GoMock package.

Jump to

Keyboard shortcuts

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