Documentation ¶
Index ¶
- type TelegramClient
- func (t *TelegramClient) AddReaction(chatID int64, messageID int, emoji string) error
- func (t *TelegramClient) DeleteMessage(chatID int64, messageID int) error
- func (t *TelegramClient) EditMessage(chatID int64, messageID int, newMessage string) error
- func (t *TelegramClient) GetUpdates() ([]tgbotapi.Update, error)
- func (t *TelegramClient) SendMessage(chatID int64, message string) (int, error)
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