utils

package
v0.0.0-...-fc5749a Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SlackParams = slack.PostMessageParameters{
	UnfurlMedia: true,
	UnfurlLinks: true,
	Markdown:    true,
}

Functions

func Choice

func Choice(option []string) string

func FmtDuration

func FmtDuration(d time.Duration) string

func FortyTwoMiddleware

func FortyTwoMiddleware(fn func(string, *Message) bool) func(string, *Message) bool

FortyTwoMiddleware is a middleware that makes sure that the api client for the fortytwo api is properly created

func GetLogin

func GetLogin(option string, event *Message) (string, bool)

func HandleRouletteStat

func HandleRouletteStat(event *Message)

func IndexOf

func IndexOf(word string, data []string) int

func IntraLogtime

func IntraLogtime(user string, rangeBegin time.Time, rangeEnd time.Time, client *api42.Client42) time.Duration

func Logtime

func Logtime(user string, rangeBegin time.Time, rangeEnd time.Time, client *api42.Client42) time.Duration

func PostMsg

func PostMsg(event *Message, options ...slack.MsgOption)

func PrettyDurationPrinting

func PrettyDurationPrinting(d time.Duration) string

Types

type Message

type Message struct {
	Message         string
	Channel         string
	User            string
	Timestamp       string
	ThreadTimestamp string
	API             *slack.Client
	FortyTwo        *api42.Client42
	React           []React
}

type Music

type Music struct {
	Login string `json:"login"`
	Link  string `json:"link"`
}

type React

type React struct {
	Name      string   `json:"name"`
	Reaction  string   `json:"reaction"`
	Reactions []string `json:"reactions"`
	Match     string   `json:"match"`
	Compiled  *regexp.Regexp
}

Jump to

Keyboard shortcuts

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