Documentation
¶
Index ¶
- type SlackService
- 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, error)
- func (s *SlackService) GetChannels() ([]components.ChannelItem, error)
- func (s *SlackService) GetMessages(channelID string, count int) ([]components.Message, error)
- func (s *SlackService) GetUserPresence(userID string) (string, error)
- func (s *SlackService) MarkAsRead(channelID string)
- func (s *SlackService) SendMessage(channelID string, message string) error
Constants ¶
This section is empty.
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 Conversations []slack.Channel 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) 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, error)
func (*SlackService) GetChannels ¶
func (s *SlackService) GetChannels() ([]components.ChannelItem, error)
func (*SlackService) GetMessages ¶
func (s *SlackService) GetMessages(channelID string, count int) ([]components.Message, error)
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) MarkAsRead ¶ added in v0.3.0
func (s *SlackService) MarkAsRead(channelID string)
MarkAsRead will set the channel as read
func (*SlackService) SendMessage ¶
func (s *SlackService) SendMessage(channelID string, message string) error
SendMessage will send a message to a particular channel