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.inspect(request) All fields available here. All field will be in request. With request you can track all updates. Read more

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 (just created) chat or false for already exist

Note:

BB delete blocked chats after 6 months. If user start blocked bot after 6 months this chat have just_created field again

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

the count of previously completed commands on Bot.runCommand calls. Can be used for security

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

You can inspect any variable for debug

Bot.sendMessage( inspect(user) )
Bot.sendMessage( inspect(chat) )

Last updated