client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Channels map[string]string

Channels is a map of each channelsId and the name

View Source
var InternalMessages = make(chan slack.MessageEvent, 100)

InternalMessages is internal queue of internal messages

View Source
var Users map[string]string

Users is a lookup from user-id to user-name

Functions

func GetChannel

func GetChannel(identifier string) (id string, name string)

func GetInteraction added in v1.3.0

func GetInteraction(event slack.MessageEvent, text string, command string, args ...string) *slack.ActionBlock

func GetJiraClient

func GetJiraClient(cfg config.Jira) (*jira.Client, error)

GetJiraClient created a jira client based on gopkg.in/andygrunwald/go-jira.v1

func GetSlackLink(name string, url string, args ...string) slack.AttachmentAction

func GetUser

func GetUser(identifier string) (id string, name string)

Types

type Slack

type Slack struct {
	slack.RTM
	// contains filtered or unexported fields
}

func GetSlackClient

func GetSlackClient(cfg config.Slack, logger *logrus.Logger) *Slack

GetSlackClient establishes a RTM connection to the slack server

func (Slack) AddReaction

func (s Slack) AddReaction(name string, item slack.ItemRef)

func (Slack) RemoveReaction

func (s Slack) RemoveReaction(name string, item slack.ItemRef)

func (Slack) Reply

func (s Slack) Reply(event slack.MessageEvent, text string, options ...slack.MsgOption)

Reply fast reply via RTM websocket

func (Slack) ReplyError

func (s Slack) ReplyError(event slack.MessageEvent, err error)

func (Slack) SendMessage

func (s Slack) SendMessage(event slack.MessageEvent, text string, options ...slack.MsgOption) string

SendMessage is the "slow" reply via POST request, needed for Attachment or MsgRef

func (Slack) SendToUser

func (s Slack) SendToUser(user string, text string) string

SendToUser sends a message to any user via IM channel

type SlackClient

type SlackClient interface {
	// Reply a message to the current channel/user/thread
	Reply(event slack.MessageEvent, text string, options ...slack.MsgOption)

	// ReplyError Replies a error to the current channel/user/thread + log it!
	ReplyError(event slack.MessageEvent, err error)

	// SendMessage is the extended version of Reply and accepts any slack.MsgOption
	SendMessage(event slack.MessageEvent, text string, options ...slack.MsgOption) string

	SendToUser(user string, text string) string

	RemoveReaction(name string, item slack.ItemRef)
	AddReaction(name string, item slack.ItemRef)
	GetReactions(item slack.ItemRef, params slack.GetReactionsParameters) ([]slack.ItemReaction, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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