notify

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package notify has functions and types used for sending notifications on different communication channel

Package notify has functions and types used for sending notifications on different communication channel

Package notify has functions and types used for sending notifications on different communication channel

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	ID   string
	Pass string
}

func (*Email) SendMessage

func (e *Email) SendMessage(body string) error

SendMessage takes message body and send it to the given email-id

type Notifier

type Notifier interface {
	SendMessage(string) error
}

Notifier can be any type that can SendMessage

func NewEmail

func NewEmail(id, pass string) Notifier

NewEmail returns the instance of Email

func NewTelegram

func NewTelegram(username, token string) (Notifier, error)

NewTelegram returns new instance of Telegram service that has new BotAPI instance and chatID.

It requires a username to fetch the appropriate chatID and a token provided by @BotFather on Telegram to create bot Instance

type Telegram

type Telegram struct {
	ChatID int64
	Bot    *tgbotapi.BotAPI
}

func (*Telegram) SendMessage

func (t *Telegram) SendMessage(body string) error

SendMessage takes message body and send it to the given chatID as text message or file

Jump to

Keyboard shortcuts

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