Learning TBL¶
TBL looks like JavaScript because it mostly is — same syntax for variables, if, loops, objects. What's different is what's already there: Bot, Api, user, chat, no npm install, no Express server.
You write logic inside commands. Telegram sends an update, TBL picks a command, your code runs, execution ends. That's the whole lifecycle.
Sync by default¶
Lines run in order. Most Bot and Api calls work that way out of the box.
When you need a response before continuing — grab a message id, check whether send succeeded — add await:
Don't sprinkle await on calls where you ignore the result.
Your first line of code¶
Drop that in a command's logic field, trigger the command on Telegram, you get a reply. Everything else builds from there.
Where to go¶
- Tutorials if you learn by doing
- Command Structure for triggers and special commands
- Global Variables for
user,chat,update, and the rest of the built-in context - Bot and Api when you start calling instances in commands
- Bot vs Api after both overviews — clears up the overlap between the two