Documentation ¶
Overview ¶
Package structures provides functions to parse Slack data types.
Index ¶
- Variables
- func FixMpIMmembers(ch *slack.Channel, users []slack.User) (*slack.Channel, error)
- func FormatSlackTS(ts time.Time) string
- func HasExcludePrefix(s string) bool
- func IsURL(s string) bool
- func IsValidSlackURL(s string) bool
- func ParseSlackTS(timestamp string) (time.Time, error)
- func ParseThreadID(threadID string) (time.Time, error)
- func ResolveURLs(idsOrURLs []string) ([]string, error)
- type EntityList
- type SlackLink
- type UserIndex
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FixMpIMmembers ¶ added in v2.2.0
FixMpIMmembers verifies Channel.Members to contain all channel members, if not, it attempts to populate it by parsing out the usernames from name_normalized, and populating Channel.Members with IDs of the users discovered. usernameIDs is a mapping of username -> user_id.
func FormatSlackTS ¶
func HasExcludePrefix ¶ added in v2.0.1
func IsValidSlackURL ¶ added in v2.0.1
IsValidSlackURL returns true if the value looks like valid Slack URL, false if not.
func ParseSlackTS ¶
ParseSlackTS parses the slack timestamp.
func ParseThreadID ¶
ParseThreadID parses the thread id (ie. p1577694990000400) and returns time.Time.
func ResolveURLs ¶ added in v2.0.1
ResolveURLs normalises all channels to ID form. If the idsOrURLs[i] is a channel ID, it is unmodified, if it is URL - it is parsed and replaced with the channel ID. If the channel is marked for exclusion in the list it will retain this status.
Types ¶
type EntityList ¶ added in v2.0.1
EntityList is an Inclusion/Exclusion list
func LoadEntityList ¶ added in v2.0.1
func LoadEntityList(filename string) (*EntityList, error)
MakeEntityList creates an EntityList from a slice of IDs or URLs (entites).
func NewEntityList ¶ added in v2.5.0
func NewEntityList(entities []string) (*EntityList, error)
NewEntityList creates an EntityList from a slice of IDs or URLs (entites).
func (*EntityList) HasExcludes ¶ added in v2.0.1
func (el *EntityList) HasExcludes() bool
func (*EntityList) HasIncludes ¶ added in v2.0.1
func (el *EntityList) HasIncludes() bool
func (*EntityList) Index ¶ added in v2.0.1
func (el *EntityList) Index() map[string]bool
Index returns a map where key is entity, and value show if the entity should be processed (true) or not (false).
func (*EntityList) IsEmpty ¶ added in v2.0.1
func (el *EntityList) IsEmpty() bool
type SlackLink ¶ added in v2.0.1
func ParseLink ¶ added in v2.0.1
ParseLink parses the slack link string. It supports the following formats:
- XXXXXXX - channel ID
- XXXXXXX:99999999.99999 - channel ID and thread ID
- https://<valid slack URL> - slack URL link.
It returns the SlackLink or error.
func ParseURL ¶
ParseURL parses the slack link in the format of https://xxxx.slack.com/archives/XXXXX[/p99999999]
type UserIndex ¶
UserIndex is a mapping of user ID to the *slack.User.
func NewUserIndex ¶
NewUserIndex creates a new UserIndex from slack Users slice
func (UserIndex) ChannelName ¶
ChannelName return the "beautified" name of the channel.
func (UserIndex) DisplayName ¶ added in v2.2.0
DisplayName tries to resolve the display name by ID. if the index is empty, it returns the user ID. If the user is not found in index, is assumes that it is an external user and returns ID with "external" prefix. If it does find the user and display name is unavailble, it returns the Real Name.
func (UserIndex) IsDeleted ¶
IsDeleted checks if the user is deleted and returns appropriate value. It will assume user is not deleted, if it's not present in the user index.