Variables
In BJS we have useful global variables.
Variable | Description |
request | it is collection with a lot of data. You can see it by Bot.sendMessage( inspect(request) )
All fields available here. All field will be in request. |
message | current message from user - string |
user | user who sent a command or text. Fields:
id (BB id), telegramid (telegram id), first_name, last_name, username, created_at, updated_at, just_created (true for new user or false for already exist. User must be totally new in BB - he is old if he start any BB bot before)
Can be blank: first_name, last_name, username
|
chat | data for current chat. Fields: id (BB id), chatid (telegram chat id), bot_id, title, chat_type (can be: "private", "group", "supergroup"), user_id, created_at, updated_at, just_created (true for new chat or false for already exist) Note: User can block bot chat - so chat can be removed. But then user can start bot again - so chat.just_created - will be true but user.just_created will be false
|
bot | data for bot. Fields: id , name , token , created_at , updated_at , csv_url , last_run_at , store_bot_id , status |
command | data for command. Fields: id , name , folder , need_reply , auto_retry_time , last_auto_retry_at , created_via_csv_import , last_csv_import_at , created_at , updated_at |
params | command parameters - text |
owner | information about bot owner: email, id and etc |
completed_commands_count | |
iteration_quota | current quota information: limit, progress and etc. You can see it by Bot.sendMessage( inspect(iteration_quota) ) |
payment_plan | current bot owner payment plan information |
BB_API_URL | api url: api.bots.business. Each Cloud have own Api Url |
Bot.sendMessage( inspect(user) )
Bot.sendMessage( inspect(chat) )
Last modified 1d ago