structures

package
v2.0.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package structures provides functions to parse Slack data types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSlackTS

func FormatSlackTS(ts time.Time) string

func ParseSlackTS

func ParseSlackTS(timestamp string) (time.Time, error)

ParseSlackTS parses the slack timestamp.

func ParseThreadID

func ParseThreadID(threadID string) (time.Time, error)

ParseThreadID parses the thread id (ie. p1577694990000400) and returns time.Time.

Types

type UrlInfo

type UrlInfo struct {
	Channel  string
	ThreadTS string
}

func ParseURL

func ParseURL(slackURL string) (*UrlInfo, error)

func (UrlInfo) IsThread

func (u UrlInfo) IsThread() bool

func (UrlInfo) IsValid

func (u UrlInfo) IsValid() bool

type UserIndex

type UserIndex map[string]*slack.User

UserIndex is a mapping of user ID to the *slack.User.

func NewUserIndex

func NewUserIndex(us []slack.User) UserIndex

NewUserIndex creates a new UserIndex from slack Users slice

func (UserIndex) ChannelName

func (idx UserIndex) ChannelName(channel *slack.Channel) (who string)

ChannelName return the "beautified" name of the channel.

func (UserIndex) IsDeleted

func (idx UserIndex) IsDeleted(id string) bool

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.

func (UserIndex) Sender

func (idx UserIndex) Sender(msg *slack.Message) string

Sender returns username for the message

func (UserIndex) Username

func (idx UserIndex) Username(id string) string

Username tries to resolve the username by ID. If the user index is not initialised, it will return the ID, otherwise, if the user is not found in cache, it will assume that the user is external, and return the ID with "external" prefix.

Directories

Path Synopsis
Package files contains some additional file logic.
Package files contains some additional file logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL