first commit
This commit is contained in:
62
.history/README_20251216201331.md
Normal file
62
.history/README_20251216201331.md
Normal 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)
|
||||
|
||||
Reference in New Issue
Block a user