Bot functions
Function
Description
Bot.sendMessage(text)
Bot.sendMessage("Hello from bot")
Bot.runCommand(command, options)
Run other command
Bot.runCommand("/contact")
and with options:
Bot.runCommand("/contact", {phone: "+15424", email: "example@example.com"})
in second command /contact:
Bot.sendMessage("Phone is:" + options.phone);
Bot.run(options)
Run other command
Bot.run({ command: "/contact" })
Bot.clearRunAfter(options)
Clear other command with run_after by label
Bot.runAll(options)
Run other command for all chats
Bot.runAll({ command: "/broadcast" })
Bot.sendKeyboard(buttons, message)
send keyboard and message. Message is required
Bot.sendKeyboard("about, help,\ncontacts", "send keyboard now")
Bot.sendInlineKeyboard(buttons, message)
Send inline keyboard and message. Message is required. Buttons is array. Button must have text fields: title(required), url or command.
Bot.sendInlineKeyboard([ {title: "google", url: "http://google.com" }, {title: "other command", command: "/othercommand"} ], "Please make a choice.")
Bot.editInlineKeyboard(buttons)
Edit exist inline keyboard after executing the command that was called by its button
Bot.editInlineKeyboard([ {title: "google", url: "http://google.com" } ])
Bot.setProp(name, value)
Bot.setProp("TotalScore", 100)
Also you can pass type: Bot.setProp(name, value, type)
Type can be: integer, float, string, text, json, datetime
Bot.getProp(name)
Bot.getProp("TotalScore")
can get property with default value for non exist property:
Bot.getProp("TotalScore", 100)
can get property of another bot:
Bot.getProp({ name: "propName", other_bot_id: OTHER_BOT_ID })
Bot.deleteProp(name)
Delete property by it name
Bot.importCSV()
Bot.blockChat(chat_id)
Block chat:
Bot.blockChat(chat.id)
Bot.unblockChat(chat_id)
Unblock chat:
Bot.unblockChat(chat.id)
Bot.inspect(value)
Send inspected value to chat. Good for debug
Access to property in answer:
You can also use the properties in the command's answer. For example, you can do this with the / hello command:
Total score: <TotalScore>!
Bot.run(params)
Run other command
Field
Description
command
Required. Command for run. For example "/start". Can pass params
options
json for passing to command. Available through options in this command
run_after
delay in seconds before command callingName is case sensitive. can be float. Exact execution time is not guaranteed. Command will be executed in background.
background
Boolean: (true or false). By default: false. If true - command will be executed in background.
bot_id
bot_id for passing. By default this is current bot.id. This bot must be in the same BB Account
user_id
user_id for passing. By default this is current user.id
user_telegramid
user_telegramid for passing
chat_id
chat_id for passing. By default this is current chat.id
label
can be used for clearing with Bot.clearRunAfter
ignoreMissingCommand
Example 1. Run another command /balance
with delay 1 hour for current user
Example 2. Run another command /balance
with delay 5 days for this user
Bot.clearRunAfter(options)
Can clear future command(s) execution setted by Bot.run
Use this function if future command calling not needed already
Field
Description
label
Required. Command for clearing. For example "myLabel"
Example 1. Run another command /work
with delay 5 days. And remove that delay (for example on 3th day)
On the third day we learned that the call is no longer needed:
Bot.runAll(options)
Run other command for all chats
Use this command for broadcasting any information: message, photo, video, keyboard and etc
Bot.runAll works for worked bots only. If you start a new task before the previous old task has completed, there is no guarantee that the old task will complete for all chats.
You need to wait for the old task to complete before starting the new one.
Field
Description
command
Required. Command for run. For example "/start". Can pass params
options
json for passing to command. Available through options in this command
on_create
run this command on task creation with task information
for_chats
Command will be runned for this chats type only. Can be:
"private-chats"
"group-chats"
"super-group-chats"
"all"
- default
Example:
Command: /news
Command: /broadcast
Command: on_new_brodcast_task
Command: /progress
Last updated