The Bot Object
The bot global is a pre-initialized Telegraf instance. Never import or recreate it.
Available methods
Context object
Every handler receives a Telegraf ctx:
Working with the bot object
Think of NxCreator as a managed Telegraf environment. The bot variable is already set up for you — never call new Telegraf() or import Telegraf yourself. Your job is simply to register handlers on the bot object that already exists.
When you need to remember something between messages — like what step a user is on — store it in the database or use a scene. Avoid keeping mutable data in plain JavaScript variables, since that state is not shared across restarts or multiple instances.
Last updated March 22, 2026
Was this page helpful?