messenger

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MailSendDelay = 50 * time.Millisecond
	MailSubject   = "Nova ocjena iz e-Dnevnika"
)
View Source
const (
	DiscordSendDelay = 50 * time.Millisecond // recommended delay between messages

)

Variables

View Source
var (
	ErrDiscordEmptyAPIKey     = errors.New("empty Discord API key")
	ErrDiscordEmptyUserIds    = errors.New("empty list of Discord User IDs")
	ErrDiscordCreatingSession = errors.New("error creating Discord session")
	ErrDiscordCreatingChannel = errors.New("error creating Discord channel")
	ErrDiscordSendingMessage  = errors.New("error sending Discord message")
)
View Source
var (
	ErrMailSendingMessage = errors.New("error sending mail message")
	ErrMailInvalidPort    = errors.New("invalid or missing SMTP port, will try with default 465/tcp")
)
View Source
var (
	ErrSlackEmptyAPIKey    = errors.New("empty Slack API key")
	ErrSlackEmptyUserIds   = errors.New("empty list of Slack Chat IDs")
	ErrSlackSendingMessage = errors.New("error sending Slack message")
)
View Source
var (
	ErrTelegramEmptyAPIKey    = errors.New("empty Telegram API key")
	ErrTelegramEmptyUserIds   = errors.New("empty list of Telegram Chat IDs")
	ErrTelegramInvalidChatID  = errors.New("invalid Telegram Chat ID")
	ErrTelegramSendingMessage = errors.New("error sending Telegram message")
)

Functions

func Discord

func Discord(ctx context.Context, ch <-chan interface{}, token string, userIDs []string, retries uint) error

Discord messenger processes events from a channel and attempts to communicate to one or more UserIDs, optionally returning an error.

func Mail

func Mail(ctx context.Context, ch <-chan interface{}, server, port, username, password, from, subject string, to []string, retries uint) error

Mail messenger processes events from a channel and attempts to send emails to one or more recipients, optionally returning an error.

func Slack

func Slack(ctx context.Context, ch <-chan interface{}, token string, chatIDs []string, retries uint) error

Slack messenger processes events from a channel and attempts to communicate to one or more ChatIDs, optionally returning an error.

func Telegram

func Telegram(ctx context.Context, ch <-chan interface{}, apiKey string, chatIDs []string, retries uint) error

Telegram messenger processes events from a channel and attempts to communicate to one or more ChatIDs, optionally returning an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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