slack

package
v0.5.6-dev.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

An Adapter implementation for Slack.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScrubMarkdown

func ScrubMarkdown(text string) string

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

Types

type SlackAdapter

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

SlackAdapter 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 NewAdapter

func NewAdapter(provider data.SlackProvider) SlackAdapter

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

func (SlackAdapter) GetChannelInfo

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

GetChannelInfo returns the ChannelInfo for a requested channel.

func (SlackAdapter) GetName

func (s SlackAdapter) GetName() string

GetName returns this adapter's configured name

func (SlackAdapter) GetPresentChannels

func (s SlackAdapter) GetPresentChannels(userID string) ([]*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 (SlackAdapter) GetUserInfo

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

GetUserInfo returns the UserInfo for a requested user.

func (SlackAdapter) Listen

func (s SlackAdapter) Listen() <-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 (*SlackAdapter) OnChannelMessage

func (s *SlackAdapter) OnChannelMessage(event *slack.MessageEvent, info *adapter.Info) *adapter.ProviderEvent

OnChannelMessage is called when the Slack API emits an MessageEvent for a message in a channel.

func (*SlackAdapter) OnConnected

func (s *SlackAdapter) OnConnected(event *slack.ConnectedEvent, info *adapter.Info) *adapter.ProviderEvent

OnConnected is called when the Slack API emits a ConnectedEvent.

func (*SlackAdapter) OnConnectionError

func (s *SlackAdapter) OnConnectionError(event *slack.ConnectionErrorEvent, info *adapter.Info) *adapter.ProviderEvent

OnConnectionError is called when the Slack API emits an ConnectionErrorEvent.

func (*SlackAdapter) OnDirectMessage

func (s *SlackAdapter) OnDirectMessage(event *slack.MessageEvent, info *adapter.Info) *adapter.ProviderEvent

OnDirectMessage is called when the Slack API emits an MessageEvent for a direct message.

func (*SlackAdapter) OnDisconnected

func (s *SlackAdapter) OnDisconnected(event *slack.DisconnectedEvent, info *adapter.Info) *adapter.ProviderEvent

OnDisconnected is called when the Slack API emits a DisconnectedEvent.

func (*SlackAdapter) OnInvalidAuth

func (s *SlackAdapter) OnInvalidAuth(event *slack.InvalidAuthEvent, info *adapter.Info) *adapter.ProviderEvent

OnInvalidAuth is called when the Slack API emits an InvalidAuthEvent.

func (*SlackAdapter) OnMessage

func (s *SlackAdapter) OnMessage(event *slack.MessageEvent, info *adapter.Info) *adapter.ProviderEvent

OnMessage is called when the Slack API emits a MessageEvent.

func (*SlackAdapter) OnRTMError

func (s *SlackAdapter) OnRTMError(event *slack.RTMError, info *adapter.Info) *adapter.ProviderEvent

OnRTMError is called when the Slack API emits an RTMError.

func (SlackAdapter) SendErrorMessage

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

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

func (SlackAdapter) SendMessage

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

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

Jump to

Keyboard shortcuts

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