Libs development

You can create own Lib. Now it is possible create lib only with Git importingarrow-up-right.

Official Bots.Business repository available herearrow-up-right

You can store common code in the library.

circle-check

Basic

For example: code in file libs\myLib.js:

function hello(){
  Bot.sendMessage("Hello from lib!")
}

function goodbye(name){
  Bot.sendMessage("Goodbye, " + name)
}

publish({
  sayHello: hello,
  sayGoodbyeTo: goodbye     
})

then you can use Lib in any bot's command:

Commands capturing

It is possible to capture command with lib.

For example:

  • user type "Hi"

  • bot answer "Hello"

Master command "*" - for capture any text from user with lib

circle-info

You can use all BJS functions in the Libs

Using HTTP

Lib can perform web requests. For example: get page from eample.com and send its content to user.

on Bot command:

See morearrow-up-right

Last updated