Autobot::Channels::TelegramChannel
Inherits Autobot::Channels::Channel < Reference < Object
Telegram channel using long polling via the Bot API.
Features:
- Long polling (no webhook/public IP needed)
- Built-in commands (/start, /reset, /help)
- Custom commands (macros + bash scripts)
- Media handling (photos, voice, documents)
- Typing indicators
- Markdown-to-Telegram HTML conversion
- Allow list for access control
Constants
CHAT_LOG_KEEP_LINES = 100
CHAT_LOG_MAX_BYTES = 64000
DOCUMENT_CAPTION_LIMIT = 1024
EMPTY_MESSAGE_LABEL = "[empty message]"
GETME_MAX_ATTEMPTS = 5
GETME_RETRY_DELAY = 2.seconds
Log = ::Log.for("channels.telegram")
MAX_IMAGE_SIZE = (20 * 1024) * 1024
MEDIA_LOG_LABEL = "[media]"
MULTIPART_BOUNDARY = "----AutobotMediaBoundary"
PHOTO_CAPTION_LIMIT = 1024
POLL_TIMEOUT = 30
READ_CHUNK_SIZE = 4096
SCRIPT_OUTPUT_LIMIT = 4000
TELEGRAM_API_BASE = "https://api.telegram.org"
TYPING_INTERVAL = 4.0
Constructors
new(bus : Bus::MessageBus, token : String, allow_from : Array(String) = [] of String, proxy : String | Nil = nil, custom_commands : Config::CustomCommandsConfig = Config::CustomCommandsConfig.new, session_manager : Session::Manager | Nil = nil, transcriber : Transcriber | Nil = nil, cron_service : Cron::Service | Nil = nil, inbox : Media::Inbox | Nil = nil)
SourceInstance methods
send_message(message : Bus::OutboundMessage) : Nil
Send an outbound message through this channel.