Documentation
¶
Index ¶
- Constants
- type SlackService
- func (s *SlackService) ChannelsToString() []string
- func (s *SlackService) CreateMessage(message slack.Message) []components.Message
- func (s *SlackService) CreateMessageFromAttachments(atts []slack.Attachment) []components.Message
- func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent) []components.Message
- func (s *SlackService) GetChannels() []string
- func (s *SlackService) GetMessages(channel interface{}, count int) []components.Message
- func (s *SlackService) GetSlackChannel(selectedChannel int) interface{}
- func (s *SlackService) GetUserPresence(userID string) (string, error)
- func (s *SlackService) MarkAsRead(channelID int)
- func (s *SlackService) MarkAsUnread(channelID string)
- func (s *SlackService) SendMessage(channelID int, message string)
- func (s *SlackService) SetChannelReadMark(channel interface{})
- func (s *SlackService) SetPresenceChannelEvent(userID string, presence string)
Constants ¶
const ( ChannelTypeChannel = "channel" ChannelTypeGroup = "group" ChannelTypeIM = "im" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SlackService ¶
type SlackService struct { Config *config.Config Client *slack.Client RTM *slack.RTM SlackChannels []interface{} Channels []components.ChannelItem UserCache map[string]string CurrentUserID string CurrentUsername string }
func NewSlackService ¶
func NewSlackService(config *config.Config) (*SlackService, error)
NewSlackService is the constructor for the SlackService and will initialize the RTM and a Client
func (*SlackService) ChannelsToString ¶ added in v0.3.0
func (s *SlackService) ChannelsToString() []string
ChannelsToString will relay the string representation for a channel
func (*SlackService) CreateMessage ¶
func (s *SlackService) CreateMessage(message slack.Message) []components.Message
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) CreateMessageFromAttachments ¶ added in v0.3.0
func (s *SlackService) CreateMessageFromAttachments(atts []slack.Attachment) []components.Message
CreateMessageFromAttachments will construct a array of string of the Field values of Attachments from a Message.
func (*SlackService) CreateMessageFromMessageEvent ¶
func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent) []components.Message
func (*SlackService) GetChannels ¶
func (s *SlackService) GetChannels() []string
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) []components.Message
GetMessages will get messages for a channel, group or im channel delimited by a count.
func (*SlackService) GetSlackChannel ¶ added in v0.3.0
func (s *SlackService) GetSlackChannel(selectedChannel int) interface{}
GetSlackChannel returns the representation of a slack channel
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) MarkAsRead ¶ added in v0.3.0
func (s *SlackService) MarkAsRead(channelID int)
MarkAsRead will set the channel as read
func (*SlackService) MarkAsUnread ¶ added in v0.3.0
func (s *SlackService) MarkAsUnread(channelID string)
MarkAsUnread will set the channel as unread
func (*SlackService) SendMessage ¶
func (s *SlackService) SendMessage(channelID int, 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.
func (*SlackService) SetPresenceChannelEvent ¶ added in v0.3.0
func (s *SlackService) SetPresenceChannelEvent(userID string, presence string)
SetPresenceChannelEvent will set the presence of a IM channel