This is a Telegram bot developed in JavaScript with the Telegraf library, which allows to automatically ban users from a group if they have a specific ID. The bot stores a list of IDs in a .json file and checks if a user who enters the group has any of these IDs. If so, the user is automatically banned.
- Clone this repository to your computer.
- Install the necessary dependencies using the command
npm install
. - Copy the .env.copy file to a .env in the project root and add the
BOT_TOKEN
key with your Telegram bot token. - Create a
spam-users-id.json
file in the project root and add the IDs of the users you want to ban. For example:
[5753128895, 1548692361, 5800820904]
- Run the bot using the command
npm start
.
- /add [id] - Adds an ID to the list of banned users.
- /deleteid [id] - Removes an ID from the list of banned users.
- /count [id] - Returns with the number of users in the list
- /list - Shows the list of banned IDs.
Make sure your bot has permission to ban users in groups. The bot only checks the IDs of users who enter the group after it is started. If a user is already in the group when the bot is started, the bot will not automatically ban the user.