botuser

package
v0.0.0-...-f0e13e9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecondsToHuman

func SecondsToHuman(input int) string

SecondsToHuman converts seconds (int) to HH:MM format

Types

type AttachmentItem

type AttachmentItem struct {
	SlackAttachment slack.Attachment
	Points          int
}

AttachmentItem is needed to sort attachments

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot struct used for storing and communicating with slack api

func New

func New(config *config.Config, bundle *i18n.Bundle, settings model.Workspace, db *storage.DB) *Bot

New creates new Bot instance

func (*Bot) CallDisplayWeeklyTeamReport

func (bot *Bot) CallDisplayWeeklyTeamReport() error

CallDisplayWeeklyTeamReport calls displayWeeklyTeamReport

func (*Bot) CallDisplayYesterdayTeamReport

func (bot *Bot) CallDisplayYesterdayTeamReport() error

CallDisplayYesterdayTeamReport calls displayYesterdayTeamReport

func (*Bot) GetCollectorData

func (bot *Bot) GetCollectorData(getDataOn, data, dateFrom, dateTo string) (CollectorData, error)

GetCollectorData sends api request to collector servise and returns collector object

func (*Bot) GetCollectorDataOnMember

func (bot *Bot) GetCollectorDataOnMember(member model.Standuper, startDate, endDate time.Time) (CollectorData, CollectorData, error)

GetCollectorDataOnMember sends API request to Collector endpoint and returns CollectorData type

func (*Bot) HandleJoin

func (bot *Bot) HandleJoin(joinEvent *slack.MemberJoinedChannelEvent) (model.Project, error)

HandleJoin handles comedian joining channel

func (*Bot) HandleMessage

func (bot *Bot) HandleMessage(msg *slack.MessageEvent) error

HandleMessage handles slack message event

func (*Bot) ImplementCommands

func (bot *Bot) ImplementCommands(command slack.SlashCommand) string

ImplementCommands implements slash commands such as adding users and managing deadlines

func (*Bot) SendEphemeralMessage

func (bot *Bot) SendEphemeralMessage(channel, user, message string) error

SendEphemeralMessage posts a message in a specified channel which is visible only for selected user

func (*Bot) SendMessage

func (bot *Bot) SendMessage(channel, message string, attachments []slack.Attachment) error

SendMessage posts a message in a specified channel visible for everyone

func (*Bot) SendUserMessage

func (bot *Bot) SendUserMessage(userID, message string) error

SendUserMessage Direct Message specific user

func (*Bot) SetProperties

func (bot *Bot) SetProperties(settings *model.Workspace) *model.Workspace

SetProperties updates bot settings

func (*Bot) Settings

func (bot *Bot) Settings() *model.Workspace

Settings just returns bot settings

func (*Bot) Start

func (bot *Bot) Start()

Start updates Users list and launches notifications

func (*Bot) Stop

func (bot *Bot) Stop()

Stop closes bot quitChan making bot goroutine to exit

func (*Bot) Suits

func (bot *Bot) Suits(team string) bool

Suits returns true if found desired bot workspace

type CollectorData

type CollectorData struct {
	Commits  int `json:"total_commits"`
	Worklogs int `json:"worklogs"`
}

CollectorData used to parse data on user from Collector

type Message

type Message struct {
	Type        string
	Channel     string
	User        string
	Text        string
	Attachments []slack.Attachment
}

Message represent any message that can be send to Slack or any other destination

Jump to

Keyboard shortcuts

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