telegram

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 3 Imported by: 20

Documentation

Index

Constants

View Source
const (
	ModeMarkdown = tgbotapi.ModeMarkdown
	ModeHTML     = tgbotapi.ModeHTML
)

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.

func (*Telegram) SetClient added in v0.40.0

func (t *Telegram) SetClient(client *tgbotapi.BotAPI)

SetClient set a new custom BotAPI instance. For example allowing you to use NewBotAPIWithClient:

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

func (*Telegram) SetParseMode added in v0.30.0

func (t *Telegram) SetParseMode(mode string)

SetParseMode sets the parse mode for the message body. For more information about telegram constants:

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

Jump to

Keyboard shortcuts

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