service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2016 License: MIT Imports: 5 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID    string
	Name  string
	Topic string
}

type SlackService

type SlackService struct {
	Client        *slack.Client
	RTM           *slack.RTM
	SlackChannels []interface{}
	Channels      []Channel
	UserCache     map[string]string
	CurrentUserID string
}

func NewSlackService

func NewSlackService(token string) *SlackService

NewSlackService is the constructor for the SlackService and will initialize the RTM and a Client

func (*SlackService) CreateMessage

func (s *SlackService) CreateMessage(message slack.Message) []string

CreateMessage will create a string formatted message that can be rendered in the Chat pane.

[23:59] <erroneousboat> Hello world!

This returns an array of string because we will try to uncover attachments associated with messages.

func (*SlackService) CreateMessageFromMessageEvent

func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent) []string

func (*SlackService) GetChannels

func (s *SlackService) GetChannels() []Channel

GetChannels will retrieve all available channels, groups, and im channels. Because the channels are of different types, we will append them to an []interface as well as to a []Channel which will give us easy access to the id and name of the Channel.

func (*SlackService) GetMessages

func (s *SlackService) GetMessages(channel interface{}, count int) []string

GetMessages will get messages for a channel, group or im channel delimited by a count.

func (*SlackService) SendMessage

func (s *SlackService) SendMessage(channel string, message string)

SendMessage will send a message to a particular channel

func (*SlackService) SetChannelReadMark added in v0.2.0

func (s *SlackService) SetChannelReadMark(channel interface{})

SetChannelReadMark will set the read mark for a channel, group, and im channel based on the current time.

Jump to

Keyboard shortcuts

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