Basics
BuilderEngine runs your bot logic using **modern JavaScript**, including support for `async/await`, Promises, and ES6+ features. Each `.js` file represents a handler that responds to specific commands or Telegram updates.
JavaScript Support
BuilderEngine uses an asynchronous JavaScript engine, giving you access to:
- ✅
async/await - ✅ Promises
- ✅ Modern syntax (arrow functions, destructuring, template literals)
- ✅ Full access to Telegram API via
Api.xxxx()
File Template
Each JavaScript file must have proper error handlings.
When the matching command is triggered (e.g., /start), this function runs.
Available Variables
Your function gets passed a context object with the following fields:
| Field | Description |
|---|---|
update | Incoming updates object |
Bot. | Class of quick telegram actions |
Api. | Class of all telegram api methods |
HTTP | Access internet with external apis and urls |
os | Access server objects and secrets |
Storage | Access our official key-value database |
Common Mistakes
- Forgetting
awaiton asynchronous calls. - Trying to use blocking/slow code — stay under timeout!
- Case mismatch on commands (they're case-sensitive).
Best Practices
- Structure logic clearly and modularly.
- Handle both
messageandcallbackgracefully. - Always validate update by
updatevariable. - Use
Api.for Telegram-specific tasks like media or formatting.
Need More?
- Check the Files page to learn how commands link to files.
- Refer to Telegram Bot API Docs for full method reference.
- Test your files using
/startor by triggering the commands directly.
JavaScript is the brain of your bot—write smart, async-powered logic!