telegram

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	API *tgbotapi.BotAPI
	// contains filtered or unexported fields
}

func NewBot

func NewBot(l *logger.Logger, cfg *Config) (*Bot, error)

NewBot creates a new Bot instance with the configuration.

func (*Bot) GetAPI

func (b *Bot) GetAPI() *tgbotapi.BotAPI

GetAPI returns the bot's API instance.

func (*Bot) GetCfg

func (b *Bot) GetCfg() *Config

GetCfg returns the bot's configuration.

func (*Bot) SendMessage

func (b *Bot) SendMessage(c tgbotapi.Chattable) (tgbotapi.Message, error)

SendMessage sends a message using the bot's API.

func (*Bot) SetCommands

func (b *Bot) SetCommands(commands []tgbotapi.BotCommand) error

SetCommands sets the bot commands that will be shown in the UI.

type Config

type Config struct {
	BotToken         string `envconfig:"TELEGRAM_API_TOKEN" required:"true"`
	UpdateCfgTimeout int    `envconfig:"TELEGRAM_UPDATE_CONFIG_TIMEOUT" default:"60"`
	IsDebug          bool   `envconfig:"TELEGRAM_DEBUG" default:"false"`
}

Config holds the configuration for the Telegram bot.

func NewConfig

func NewConfig() *Config

Jump to

Keyboard shortcuts

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