telegram

package
v0.17.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Telegram

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

Telegram struct holds necessary data to communicate with the Telegram API.

func New

func New(apiToken string) (*Telegram, error)

New returns a new instance of a Telegram notification service. For more information about telegram api token:

-> https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#NewBotAPI

func (*Telegram) AddReceivers

func (t *Telegram) AddReceivers(chatIDs ...int64)

AddReceivers takes Telegram chat IDs and adds them to the internal chat ID list. The Send method will send a given message to all those chats.

func (Telegram) Send

func (t Telegram) Send(ctx context.Context, subject, message string) error

Send takes a message subject and a message body and sends them to all previously set chats. Message body supports html as markup language.

Jump to

Keyboard shortcuts

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