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:

FieldDescription
updateIncoming updates object
Bot.Class of quick telegram actions
Api.Class of all telegram api methods
HTTPAccess internet with external apis and urls
osAccess server objects and secrets
StorageAccess our official key-value database

Common Mistakes

  • Forgetting await on 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 message and callback gracefully.
  • Always validate update by update variable.
  • 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 /start or by triggering the commands directly.

JavaScript is the brain of your bot—write smart, async-powered logic!