Documentation ¶
Index ¶
- type Message
- type MessageRef
- func (msg MessageRef) GetChannel() string
- func (msg MessageRef) GetThread() string
- func (msg MessageRef) GetTime() time.Time
- func (msg MessageRef) GetTimestamp() string
- func (msg MessageRef) GetUniqueKey() string
- func (msg MessageRef) GetUser() string
- func (msg MessageRef) IsInternalMessage() bool
- func (msg MessageRef) IsUpdatedMessage() bool
- func (msg MessageRef) WithText(text string) Message
- type Ref
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { MessageRef Text string `json:"text,omitempty"` Done *sync.WaitGroup `json:"-"` // WaitGroup gets unlocked when the message was processed }
Message represents a slack.Message in a slim format. The MessageRef contains the context of the message
func FromSlackEvent ¶
func FromSlackEvent(event *slack.MessageEvent) Message
FromSlackEvent generates a slack.MessageEvent into a msg.Message
func (*Message) AddDoneHandler ¶
AddDoneHandler will register a sync.WaitGroup
func (*Message) GetMessageRef ¶
GetMessageRef create a msg.ItemRef, an unique identifier to a message
type MessageRef ¶
type MessageRef struct { Channel string `json:"channel,omitempty"` User string `json:"user,omitempty"` Timestamp string `json:"ts,omitempty"` Thread string `json:"thread_ts,omitempty"` InternalMessage bool `json:"InternalMessage,omitempty"` UpdatedMessage bool `json:"updated,omitempty"` }
MessageRef is holds meta information for an message, like author, creation date or channel
func (MessageRef) GetChannel ¶
func (msg MessageRef) GetChannel() string
GetChannel returns the channel id (usually starting with "C") of the current message
func (MessageRef) GetThread ¶
func (msg MessageRef) GetThread() string
GetThread returns the thread "timestamp" of the message
func (MessageRef) GetTime ¶
func (msg MessageRef) GetTime() time.Time
GetTime extracts the time.Time of the Message
func (MessageRef) GetTimestamp ¶
func (msg MessageRef) GetTimestamp() string
GetTimestamp returns the slack-timestamp of the message (e.g. 1613728332.201900)
func (MessageRef) GetUniqueKey ¶
func (msg MessageRef) GetUniqueKey() string
GetUniqueKey generated a unique identifier for a message (based on the user/channel/thread)
func (MessageRef) GetUser ¶
func (msg MessageRef) GetUser() string
GetUser returns the user id (usually starting with "U") of the current message
func (MessageRef) IsInternalMessage ¶
func (msg MessageRef) IsInternalMessage() bool
IsInternalMessage is set when the bot is generating internal messages which are handles (like from "cron" command)
func (MessageRef) IsUpdatedMessage ¶
func (msg MessageRef) IsUpdatedMessage() bool
IsUpdatedMessage identifies if the processed message should be updated (like with a "refresh" button)
func (MessageRef) WithText ¶
func (msg MessageRef) WithText(text string) Message
WithText attaches a text to a message