Files in BuilderEngine

BuilderEngine operates based on a **file system**, where each file determines how your bot behaves. Understanding how files work is essential for building responsive bots.

FileName

  • FileName is a unique identifier used to name your file—this helps you quickly recognize its purpose.
    • Examples: Start.js, Help.js, Welcome.html
  • Allowed file extensions:
    • .js → JavaScript logic
    • .html → Web apps or Telegram WebView UIs
    • .css → Styling for HTML files
  • 🔒 Note: Two files cannot have the same name.
  • 🧠 The file name itself doesn’t affect command matching, unless the file defines the special function answerCallback().

Commands

  • A Command is a trigger from user input—either text message or callback data—that determines which file is executed.
  • The system matches commands based on prefixes (not exact match):
    • Example: If a file has the command hi, it will match messages like:
      • "hi"
      • "hithere"
      • "hi hello"
  • Commands must be defined in the file using a comma-separated list:
    • Example: "/start, home, /back" → this file will be called when user sends /start, home, or /back.
Special CommandTrigger TypeDescriptionNotes
*Unhandled MessageRuns when no other command matches.Timeout: ⏱ 3 seconds. Other command files still execute.
@All Update TypesRuns on every update (text, photo, callback, etc.).Timeout: ⏱ 3 seconds. Other command files still execute.

⚠️ Case-Sensitive Matching: Commands are case-sensitive → "Hi""hi"


File Contents

Each file contains logic or interface code:

✅ JavaScript Files (.js)

  • Used to define bot logic and handle user commands.
  • Fully supports modern asynchronous JavaScript (async/await, Promises).
  • Execution is limited by a timeout:
    • Standard: 3 seconds
    • Global Commands (@, *): extra 3 seconds

🌐 HTML Files (.html) + 🎨 CSS Files (.css)

  • Used for Telegram Web Apps, custom UIs, forms, or interactive layouts.
  • Can include full HTML5/CSS3.
  • Best for building rich, responsive experiences inside Telegram.

🧠 Key Takeaways

  • Each file in BuilderEngine is command-driven.
  • Use .js for logic, .html for UI, and .css for styles.
  • The system is flexible with partial matching and global command types.
  • Always structure files clearly and avoid command or filename duplication.

For deeper coding help, refer to the coding documentation.