telegrambot

package
v0.0.0-...-bf5f488 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TelegramClient

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

the package defines a struct `TelegramClient` that holds the Telegram bot API and it also defines methods `SendMessage`, `EditMessage`, `DeleteMessage`, `AddReaction` and `GetUpdates` that can be used to interact with Telegram.

`NewTelegramClient` function creates and returns a new TelegramClient, it takes the token of the bot as a parameter and creates a new bot using the `tgbotapi.NewBotAPI(token)` function.

`SendMessage` function sends a message to a chat using the chatID

TelegramClient is a struct that holds the Telegram bot API

func NewTelegramClient

func NewTelegramClient(token string) (*TelegramClient, error)

NewTelegramClient creates and returns a new TelegramClient

func (*TelegramClient) AddReaction

func (t *TelegramClient) AddReaction(chatID int64, messageID int, emoji string) error

AddReaction adds a reaction to a message

func (*TelegramClient) DeleteMessage

func (t *TelegramClient) DeleteMessage(chatID int64, messageID int) error

DeleteMessage delete a message in a chat

func (*TelegramClient) EditMessage

func (t *TelegramClient) EditMessage(chatID int64, messageID int, newMessage string) error

EditMessage edit a message in a chat

func (*TelegramClient) GetUpdates

func (t *TelegramClient) GetUpdates() ([]tgbotapi.Update, error)

GetUpdates gets updates from Telegram

func (*TelegramClient) SendMessage

func (t *TelegramClient) SendMessage(chatID int64, message string) (int, error)

SendMessage sends a message to a chat

Jump to

Keyboard shortcuts

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