# Libs development

You can create own Lib. Now it is possible create lib only with Git [importing](https://help.bots.business/git/import-bot-from-git-repository).

Official Bots.Business repository available [here](https://github.com/bots-business/store-libs)

You can store common code in the library.

{% hint style="success" %}
See libraries in the Library Store. You can copy any free library and modify it.
{% endhint %}

## Basic

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

```javascript
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:

```javascript
Libs.myLib.hello()
Libs.myLib.sayGoodbyeTo("Alice") 
```

## Commands capturing

It is possible to capture command with lib.

For example:

* user type "Hi"
* bot answer "Hello"&#x20;

```javascript
function onHiCommand(){
    Bot.sendMessage("Hello");
}

on('Hi', onHiCommand );
```

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

```javascript
function onMasterCommand(){
    /// input your code here
}

on('*', onMasterCommand );
```

{% hint style="info" %}
You can use all BJS functions in the Libs&#x20;
{% endhint %}

## Using HTTP

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

```javascript
libPrefix = "myLib"

function load(){
  HTTP.get( {
    url: "http://example.com",
    success: libPrefix + 'onLoading '
    // headers: headers - if you need headers
  } )
}

function onLoading(){
   Bot.sendMessage(content);
}

on(libPrefix + 'onLoading', onLoading );
```

on Bot command:

```javascript
Libs.myLib.load();
```

See [more](https://help.bots.business/scenarios-and-bjs/send-http-request)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.bots.business/libs/libs-development.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
