Documentation
¶
Index ¶
- type ClientChans
- type ConversationMarker
- type JoinPartEventData
- type MessageEventData
- type NickChangeEventData
- type SlackChannel
- type SlackClient
- func (sc *SlackClient) GetChannelMemberships() (channels []SlackChannel)
- func (sc *SlackClient) GetChannelUsers(channelID string) ([]SlackUser, error)
- func (sc *SlackClient) Initialize(token string, debug bool)
- func (sc *SlackClient) ParseMessageText(text string) string
- func (sc *SlackClient) ParseMessageTextWithOptions(text string, alwaysIncludeLinkHref bool) string
- func (sc *SlackClient) Poop(chans *ClientChans)
- func (sc *SlackClient) ResolveChannel(slackID string) (channel *SlackChannel, err error)
- func (sc *SlackClient) ResolveDMToUser(dmChannelID string) (*SlackUser, error)
- func (sc *SlackClient) ResolveNameToChannel(channelName string) *SlackChannel
- func (sc *SlackClient) ResolveNickToUser(nick string) *SlackUser
- func (sc *SlackClient) ResolveUser(slackID string) (user *SlackUser, err error)
- func (sc *SlackClient) ResolveUserToDM(user *SlackUser) (string, error)
- func (sc *SlackClient) SendDirectMessage(user *SlackUser, msg string) error
- func (sc *SlackClient) SendMessage(channel *SlackChannel, msg string) error
- func (sc *SlackClient) Tag() string
- func (sc *SlackClient) UnparseMessageText(text string) string
- type SlackConnectedEventData
- type SlackEvent
- type SlackEventType
- type SlackUser
- type TopicChangeEventData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientChans ¶
type ClientChans struct { OutgoingChan <-chan string IncomingChan chan<- *SlackEvent StopChan <-chan interface{} }
ClientChans contains a sending channel, receiving channel, and stop channel that the Slack goroutine receives outgoing commands from, sends incoming messages to, and can stop according to
type ConversationMarker ¶ added in v0.2.0
ConversationMarker handles coordination and de-duplication of marking conversations as read
func NewConversationMarker ¶ added in v0.2.0
func NewConversationMarker() *ConversationMarker
NewConversationMarker creates a new conversation marker
func (*ConversationMarker) HandleRTMAck ¶ added in v0.2.0
func (cm *ConversationMarker) HandleRTMAck(messageID int, timestamp string)
HandleRTMAck handles an ACK from the RTM channel, scheduling a read marker update if possible
func (*ConversationMarker) MarkConversation ¶ added in v0.3.2
func (cm *ConversationMarker) MarkConversation(sc *slack.Client, conversationID string, messageID int)
MarkConversation prepares a conversation marker to be updated upon receipt of an ack for the given message ID
func (*ConversationMarker) Reset ¶ added in v0.3.0
func (cm *ConversationMarker) Reset()
Reset clears any pending conversation mark events.
type JoinPartEventData ¶
JoinPartEventData represents a user joining or leaving a channel
type MessageEventData ¶
MessageEventData represents a textual message which should be delivered to IRC clients
type NickChangeEventData ¶
NickChangeEventData represents a Slack user changing their display name
type SlackChannel ¶
type SlackChannel struct { SlackID string Name string Created time.Time Private bool Topic slack.Topic }
SlackChannel holds data for a channel on Slack
type SlackClient ¶
SlackClient holds information for the websockets conn to Slack
func NewSlackClient ¶
func NewSlackClient() *SlackClient
NewSlackClient creates a new SlackClient with some default values
func (*SlackClient) GetChannelMemberships ¶
func (sc *SlackClient) GetChannelMemberships() (channels []SlackChannel)
GetChannelMemberships returns the channels this SlackClient is a member of
func (*SlackClient) GetChannelUsers ¶
func (sc *SlackClient) GetChannelUsers(channelID string) ([]SlackUser, error)
GetChannelUsers returns a locally cached list of users in the given channel
func (*SlackClient) Initialize ¶
func (sc *SlackClient) Initialize(token string, debug bool)
Initialize bootstraps the SlackClient with a client token
func (*SlackClient) ParseMessageText ¶
func (sc *SlackClient) ParseMessageText(text string) string
ParseMessageText takes raw Slack message payload and resolves the user and channel references
func (*SlackClient) ParseMessageTextWithOptions ¶
func (sc *SlackClient) ParseMessageTextWithOptions(text string, alwaysIncludeLinkHref bool) string
ParseMessageTextWithOptions takes raw Slack message payload, resolves the user and channel references, and optionally preserves the Slack canonical URL.
func (*SlackClient) Poop ¶
func (sc *SlackClient) Poop(chans *ClientChans)
Poop is a goroutine entry point that handles the communication with Slack
func (*SlackClient) ResolveChannel ¶
func (sc *SlackClient) ResolveChannel(slackID string) (channel *SlackChannel, err error)
ResolveChannel takes a slackID and fetches a SlackChannel for the ID
func (*SlackClient) ResolveDMToUser ¶
func (sc *SlackClient) ResolveDMToUser(dmChannelID string) (*SlackUser, error)
ResolveDMToUser resolves a DM/IM Channel ID to the User the DM is for
func (*SlackClient) ResolveNameToChannel ¶
func (sc *SlackClient) ResolveNameToChannel(channelName string) *SlackChannel
ResolveNameToChannel takes a channel name and fetches a SlackChannel with that name
func (*SlackClient) ResolveNickToUser ¶
func (sc *SlackClient) ResolveNickToUser(nick string) *SlackUser
ResolveNickToUser takes a nick and fetches a SlackUser with that nick
func (*SlackClient) ResolveUser ¶
func (sc *SlackClient) ResolveUser(slackID string) (user *SlackUser, err error)
ResolveUser takes a slackID and fetches a SlackUser for the ID
func (*SlackClient) ResolveUserToDM ¶ added in v0.2.0
func (sc *SlackClient) ResolveUserToDM(user *SlackUser) (string, error)
ResolveUserToDM resolves a SlackUser to their DM channel, opening one if it doesn't exist
func (*SlackClient) SendDirectMessage ¶
func (sc *SlackClient) SendDirectMessage(user *SlackUser, msg string) error
SendDirectMessage sends a message to a SlackUser
func (*SlackClient) SendMessage ¶
func (sc *SlackClient) SendMessage(channel *SlackChannel, msg string) error
SendMessage sends a message to a SlackChannel
func (*SlackClient) Tag ¶ added in v0.2.1
func (sc *SlackClient) Tag() string
Tag is a descriptor of the SlackClient suitable for logging or simple human identification.
func (*SlackClient) UnparseMessageText ¶
func (sc *SlackClient) UnparseMessageText(text string) string
UnparseMessageText takes a IRC message and inserts user references
type SlackConnectedEventData ¶
type SlackConnectedEventData struct {
UserInfo *SlackUser
}
SlackConnectedEventData represents the initial burst of data received upon establishment of a Slack RTM connection
type SlackEvent ¶
type SlackEvent struct { EventType SlackEventType Data interface{} }
A SlackEvent is an event from Slack that should be communicated to any connected IRC clients
type SlackEventType ¶
type SlackEventType int
SlackEventType represents a variant of SlackEvent
const ( SlackConnectedEvent SlackEventType = iota MessageEvent NickChangeEvent TopicChangeEvent SelfJoinEvent JoinEvent PartEvent )
Constants corresponding to event types
type TopicChangeEventData ¶
TopicChangeEventData represents a user changing the channel topic