first commit

This commit is contained in:
Michaël
2025-12-25 15:08:20 -03:00
commit f62d7b15e2
53 changed files with 4453 additions and 0 deletions

62
README.md Normal file
View File

@@ -0,0 +1,62 @@
# Keyboard Reset Bot
A minimal Telegram bot that removes reply keyboard buttons in Telegram group chats by sending a keyboard reset message.
## Features
- Works only in group chats and supergroups
- Single command: `/resetkeyboard`
- Admin-only authorization
- Automatically removes its confirmation message after 7 seconds
- Stateless (no database, no data storage)
## Setup
1. **Get a Bot Token**
- Talk to [@BotFather](https://t.me/botfather) on Telegram
- Create a new bot with `/newbot`
- Copy the bot token
2. **Install Dependencies**
```bash
npm install
```
3. **Configure Environment**
- Copy `.env.example` to `.env`
- Add your bot token:
```
BOT_TOKEN=your_bot_token_here
```
4. **Run the Bot**
```bash
npm start
```
## Usage
1. Add the bot to your Telegram group
2. Grant the bot "Read messages" permission (and optionally "Delete messages" for cleanup)
3. An admin can use `/resetkeyboard` to remove all reply keyboards in the group
## Requirements
- Node.js 14+ (ES modules support)
- Bot permissions: "Read messages" (required), "Delete messages" (optional)
## How It Works
When an admin sends `/resetkeyboard` in a group:
1. The bot verifies the user is an administrator
2. Sends a message with `ReplyKeyboardRemove` (selective: false)
3. This resets reply keyboards for all users who receive the message
4. The bot deletes its own message after 7 seconds
## Notes
- The bot ignores private chats
- Only group administrators can use the command
- The bot is stateless and does not store any data
- If another bot sends a keyboard after reset, it will appear again (expected behavior)