What's New in TBL
The latest TBL update introduces major new features for developers, giving more control, flexibility, and integration possibilities.
1. Webhook Support
TBL now supports Webhook mode. You can call bot commands directly using HTTP requests — perfect for building websites, dashboards, or automation tools that interact with your bot in real-time.
2. New Bot.read() Method
A new method Bot.read("/command") allows you to read another command's source code as a string. It's ideal for dynamic command management, code previews, or admin tools.
// Example usage
let code = Bot.read("/start")
Bot.sendMessage("Here's the code for /start:\n" + code)
Use case: Create AI code analyzers, AI chatbot or documentation systems inside your bot.
3. Buffer Support
TBL's sandbox now supports the safe version of Node.js's Buffer class. You can process binary data, files, and base64 strings directly in your commands.
// Example
let buf = Buffer.from("TBL Rocks!")
Bot.sendMessage("Buffer length: " + buf.length)
Use case: Work with files, encodings, and binary data safely inside the TBL VM.
4. Improved Bot.runCommand()
Bot.runCommand() has been improved — it now runs inside any update type (messages, callbacks, inline queries, webhooks, etc.). Previously, it only worked with message updates.
// Works everywhere now
Bot.runCommand("/start")
Use case: Trigger other commands programmatically — regardless of where the update originated.
5. Dynamic Command Handlers
TBL now supports Dynamic Commands — allowing any update type to have its own handler in the form /handle_{type}. For example, when a user joins a group, TBL automatically runs /handle_chat_member if it exists.
/*Command: /handle_chat_member*/
Bot.sendMessage("👋 Welcome " + user.first_name + "!")
This applies to all non-message updates like chat_member, poll_answer, message_reaction, etc.
- /handle_chat_member → runs when user status changes
- /handle_poll_answer → runs on poll responses
- /handle_message_reaction → runs on new reactions
- /handle_chat_boost → runs on chat boost updates
Summary
- Webhook: Trigger commands via HTTP requests
- Bot.read(): Read another command's source code
- Buffer: Safe support for Node.js Buffer class
- Bot.runCommand(): Works in all update types
- Dynamic Commands: Handle any Telegram update using /handle_{type} pattern
📚 Source
This tutorial is based on the official TeleBotHost TBL Documentation. Visit their site for the most up-to-date information and advanced guides.