Guard
Gives access to individual commands only to admins.
Initial setup:
  • Install Library
  • Сreate /setup command:
Libs.Guard.setup();
You will have such admin panel:
  • 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:
App > Bot > Admin Panels > Guard.

Checking access

Just put all your admin commands in one folder.
The check will be automatic.
For manuall checking mode use:
if (Libs.Guard.isAdmin(user.id)){
// admin
}else{
// not admin
}
Copy link