Documentation
¶
Index ¶
- Constants
- type Channel
- type SlackService
- func (s *SlackService) CreateMessage(message slack.Message) []string
- func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent) []string
- func (s *SlackService) GetChannels() []Channel
- func (s *SlackService) GetMessages(channel interface{}, count int) []string
- func (s *SlackService) GetUserPresence(userID string) (string, error)
- func (s *SlackService) SendMessage(channel string, message string)
- func (s *SlackService) SetChannelReadMark(channel interface{})
Constants ¶
const ( ChannelTypeChannel = "channel" ChannelTypeGroup = "group" ChannelTypeIM = "im" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) GetUserPresence ¶ added in v0.2.2
func (s *SlackService) GetUserPresence(userID string) (string, error)
GetUserPresence will get the presence of a specific user
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.