> For the complete documentation index, see [llms.txt](https://help.bots.business/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.bots.business/libs/guard.md).

# Guard

Gives access to individual commands only to admins.

Initial setup:

* Install Library
* Сreate `/setup` command:

```javascript
Libs.Guard.setup();
```

You will have such admin panel:

![](/files/Dorrb9aSdcroCBxfJKHq)

* Create the @ command or add to an existing one the following code (at the very beginning):

```
if (!Libs.Guard.verifyAccess()) return;
```

Add the commands you want to restrict access to to the "admins" folder (by default).

You can add/remove admins, change the folder for admin commands and add a command for unauthorized access attempts in the admin panel:&#x20;

`App > Bot > Admin Panels > Guard.`

### Checking access

{% hint style="success" %}
Just put all your admin commands in one folder.

The check will be automatic.
{% endhint %}

For manuall checking mode use:

```javascript
if (Libs.Guard.isAdmin(user.id)){
   // admin
}else{
   // not admin
}
```
