slack

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

README

An Adapter implementation for Slack.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(provider data.SlackProvider) adapter.Adapter

NewAdapter will construct a SlackAdapter instance for a given provider configuration.

func ScrubMarkdown

func ScrubMarkdown(text string) string

ScrubMarkdown removes unnecessary/undesirable Slack markdown (of links, of example) from text received from Slack.

Types

type ClassicAdapter added in v0.8.2

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

ClassicAdapter is the Slack provider implementation of a relay, which knows how to receive events from the Slack API, translate them into Gort events, and forward them along.

func (ClassicAdapter) GetChannelInfo added in v0.8.2

func (s ClassicAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)

GetChannelInfo returns the ChannelInfo for a requested channel.

func (ClassicAdapter) GetName added in v0.8.2

func (s ClassicAdapter) GetName() string

GetName returns this adapter's configured name

func (ClassicAdapter) GetPresentChannels added in v0.8.2

func (s ClassicAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)

GetPresentChannels returns a slice of channel ID strings that the Adapter is present in. This is expensive. Don't use it often.

func (ClassicAdapter) GetUserInfo added in v0.8.2

func (s ClassicAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)

GetUserInfo returns the UserInfo for a requested user.

func (ClassicAdapter) Listen added in v0.8.2

func (s ClassicAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent

Listen instructs the relay to begin listening to the provider that it's attached to. It exits immediately, returning a channel that emits ProviderEvents.

func (ClassicAdapter) SendErrorMessage added in v0.8.2

func (s ClassicAdapter) SendErrorMessage(channelID string, title string, text string) error

SendErrorMessage will send a message (from the bot) into the specified channel.

func (ClassicAdapter) SendMessage added in v0.8.2

func (s ClassicAdapter) SendMessage(channelID string, text string) error

SendMessage will send a message (from the bot) into the specified channel.

type SocketModeAdapter added in v0.8.2

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

SocketModeAdapter is the Slack provider implementation of a relay, which knows how to receive events from the Slack API, translate them into Gort events, and forward them along.

func (*SocketModeAdapter) GetChannelInfo added in v0.8.2

func (s *SocketModeAdapter) GetChannelInfo(channelID string) (*adapter.ChannelInfo, error)

GetChannelInfo provides info on a specific provider channel accessible to the adapter.

func (*SocketModeAdapter) GetName added in v0.8.2

func (s *SocketModeAdapter) GetName() string

GetName provides the name of this adapter as per the configuration.

func (*SocketModeAdapter) GetPresentChannels added in v0.8.2

func (s *SocketModeAdapter) GetPresentChannels() ([]*adapter.ChannelInfo, error)

GetPresentChannels returns a slice of channels that a user is present in.

func (*SocketModeAdapter) GetUserInfo added in v0.8.2

func (s *SocketModeAdapter) GetUserInfo(userID string) (*adapter.UserInfo, error)

GetUserInfo provides info on a specific provider user accessible to the adapter.

func (*SocketModeAdapter) Listen added in v0.8.2

func (s *SocketModeAdapter) Listen(ctx context.Context) <-chan *adapter.ProviderEvent

Listen causes the Adapter to initiate a connection to its provider and begin relaying back events (including errors) via the returned channel.

func (*SocketModeAdapter) SendErrorMessage added in v0.8.2

func (s *SocketModeAdapter) SendErrorMessage(channelID string, title string, text string) error

SendErrorMessage sends an error message to a specified channel. TODO Create a MessageBuilder at some point to replace this.

func (*SocketModeAdapter) SendMessage added in v0.8.2

func (s *SocketModeAdapter) SendMessage(channelID string, message string) error

SendMessage sends a standard output message to a specified channel. TODO Create a MessageBuilder at some point to replace this.

Jump to

Keyboard shortcuts

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