code-a1 / easyban
A simple way to ban users with NovaGram
dev-main
2021-03-29 17:42 UTC
Requires
- php: >=7.4
- skrtdev/novagram: >=1.5.1
This package is auto-updated.
Last update: 2025-03-29 00:52:38 UTC
README
A simple way to ban users with NovaGram.
EasyBan is a simple library extension for NovaGram (See novagram docs) that allows you to ban the users of your bot.
Installation via Composer
Install EasyBan via Composer
composer require code-a1/easyban dev-main
Manual installation
To install EasyBan you must only download the file from the src folder (bot.php) and require it on the file of your bot.
Usage example
Here a simple example that show how EasyBan works:
$chat = $message->chat; $text = $message->text; if(explode(" ", $text)[0] === "/ban"){ //to ban a user you must only send /ban [user_id] $Bot->banUser(explode(" ", $text)[1]); $chat->sendMessage("User Banned!"); } if(explode(" ", $text)[0] === "/unban"){ //to unban a user you must only send /unban [user_id] $Bot->unbanUser(explode(" ", $text)[1]); $chat->sendMessage("User unBanned!"); }
Methods
- isBanned() : You can use this method to check if a user is banned
- banUser() : You can use this method to ban a user
- unbanUser() : You can use this method to unBan a user