Versions in this module Expand all Collapse all v1 v1.0.0 Feb 1, 2025 Changes in this version + const ChatLimit + const GlobalLimit + const MultiChatLimit + const WaitTime + var ErrBotStarted = fmt.Errorf("cannot modify running bot") + var ErrDeleteMessageFailed = fmt.Errorf("all attempts to delete message failed") + var ErrEditMessageFailed = fmt.Errorf("all attempts to edit message failed") + var ErrInvalidStateType = fmt.Errorf("invalid state type in cache") + var ErrInvalidToken = fmt.Errorf("invalid bot token") + var ErrNegativeCleanup = fmt.Errorf("cleanup interval cannot be negative") + var ErrNegativeExpiration = fmt.Errorf("expiration time cannot be negative") + var ErrSendMessageFailed = fmt.Errorf("all attempts to send message failed") + var ErrStateHandlerNotFound = fmt.Errorf("state handler not found") + var ErrStateNotFound = fmt.Errorf("user state not found") + var ErrStatesNil = fmt.Errorf("states map is nil") + var ErrTelegramInit = fmt.Errorf("failed to initialize telegram bot api") + func NewValidationError(err error, value interface{}) error + type Bot struct + BotAPI *tgbotapi.BotAPI + func NewBot(config Config) (*Bot, error) + func (app *Bot) GetUserState(userId int64) (string, error) + func (app *Bot) HandleGlobalStates(update tgbotapi.Update) (bool, error) + func (app *Bot) HandleUpdates(offset, timeout int) + func (app *Bot) SelectHandler(update tgbotapi.Update, userState *State) (bool, error) + func (app *Bot) SetUserState(userId int64, state string) error + func (app *Bot) SetUserStateImmediate(userId int64, state string, update tgbotapi.Update) error + func (b *Bot) DeleteMessage(deleteMsg tgbotapi.DeleteMessageConfig) error + func (b *Bot) DeleteMessageRepet(msgToDelete tgbotapi.DeleteMessageConfig, numberRepetion int) error + func (b *Bot) EditMessage(editMsg tgbotapi.EditMessageTextConfig) (*tgbotapi.APIResponse, error) + func (b *Bot) EditMessageRepet(editMsg tgbotapi.EditMessageTextConfig, numberRepetion int) (*tgbotapi.APIResponse, error) + func (b *Bot) SendDeleteMessage(msg tgbotapi.DeleteMessageConfig) (*tgbotapi.APIResponse, error) + func (b *Bot) SendMessage(msg tgbotapi.MessageConfig) (tgbotapi.Message, error) + func (b *Bot) SendMessageRepet(msg tgbotapi.MessageConfig, numberRepetion int) (tgbotapi.Message, error) + func (b *Bot) SendPinMessageEvent(messageID int, ChatID int64, disableNotification bool) (*tgbotapi.APIResponse, error) + func (b *Bot) SendSticker(stickerID string, chatID int64) (*tgbotapi.Message, error) + func (b *Bot) SendUnPinAllMessageEvent(ChannelUsername string, chatID int64) (*tgbotapi.APIResponse, error) + func (b *Bot) SetLogger(logger *zerolog.Logger) error + func (b *Bot) SetUpdateHandler(handler HandlerFunc) error + func (b *Bot) Start(offset, timeout int) + func (b *Bot) Stop() + type Config struct + CleanupInterval time.Duration + Expiration time.Duration + States map[string]State + Token string + type Handler struct + Description string + Handle HandlerFunc + type HandlerFunc func(b *Bot, u tgbotapi.Update) error + type Limiter struct + ApiTimes []time.Time + ChatTimes map[int64]time.Time + MessageTimes []time.Time + func NewLimiter() *Limiter + func (l *Limiter) CheckAPI() + func (l *Limiter) CheckMessage(chatID int64) + type State struct + AtEntranceFunc *Handler + CallbackHandlers map[string]Handler + CatchAllFunc *Handler + Global bool + MessageHandlers map[string]Handler + func NewState(global bool, atEntranceFunc *Handler, catchAllFunc *Handler) *State + type ValidationError struct + Err error + Value interface{} + func (e *ValidationError) Error() string