telegram

package
v0.0.0-...-7bb490a Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Downloader

type Downloader interface {
	IsURLEligible(rawURL string) bool
	Download(rawURL string) ([]downloader.MediaFile, error)
}

type MessageHandler

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

func NewMessageHandler

func NewMessageHandler(bot *tgbotapi.BotAPI, dl Downloader, l zerolog.Logger) *MessageHandler

func (*MessageHandler) Handle

func (h *MessageHandler) Handle(msg *tgbotapi.Message) error

Handle processes an incoming Telegram message. Plain-text messages are treated as media URLs: the URL is downloaded via the Downloader, and the resulting files are sent back to the same chat as a media group (up to 10 items per batch). Files that exceed the 50 MB Telegram bot upload limit are skipped with a notice to the user. Bot commands are handled separately — /start sends a welcome message; unknown commands are silently ignored. Returns an error only for unexpected I/O failures; Telegram API errors are logged and swallowed so the update loop can continue.

Jump to

Keyboard shortcuts

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