first commit
This commit is contained in:
128
.history/about_20251216204256.md
Normal file
128
.history/about_20251216204256.md
Normal file
@@ -0,0 +1,128 @@
|
||||
BOT NAME
|
||||
Keyboard Reset Bot (working name)
|
||||
|
||||
PURPOSE
|
||||
A minimal Telegram bot whose only responsibility is to remove reply keyboard buttons in Telegram group chats by sending a keyboard reset message.
|
||||
|
||||
This bot does not manage data, users, state, or configuration beyond a single slash command.
|
||||
|
||||
CORE FUNCTIONAL REQUIREMENTS
|
||||
|
||||
Supported chats
|
||||
• Group chats
|
||||
• Supergroups
|
||||
|
||||
The bot must ignore private chats.
|
||||
|
||||
If used in a private chat, it should reply once with:
|
||||
“This bot only works in groups.”
|
||||
|
||||
Command
|
||||
Single slash command:
|
||||
|
||||
/resetkeyboard
|
||||
|
||||
No aliases. No parameters.
|
||||
|
||||
Authorization
|
||||
Only group administrators may trigger the command.
|
||||
|
||||
Authorization rules:
|
||||
• Check the user who sent /resetkeyboard
|
||||
• If the user is an administrator or creator → allow
|
||||
• Otherwise → ignore or reply with:
|
||||
“Only group admins can use this command.”
|
||||
|
||||
No role persistence. Authorization is checked per command invocation.
|
||||
|
||||
Keyboard removal behavior
|
||||
When triggered by an authorized user in a group:
|
||||
|
||||
The bot sends one normal message to the group with:
|
||||
|
||||
• reply_markup = ReplyKeyboardRemove
|
||||
• selective = false
|
||||
|
||||
This message must:
|
||||
• Be visible (not silent)
|
||||
• Not be inline
|
||||
• Not target a specific user
|
||||
|
||||
This resets the reply keyboard for all users who receive the message.
|
||||
|
||||
Message content
|
||||
Message text should be short and neutral, for example:
|
||||
|
||||
“Keyboard reset.”
|
||||
|
||||
No emojis.
|
||||
No markdown.
|
||||
No mentions.
|
||||
|
||||
Message lifecycle
|
||||
Optional but recommended:
|
||||
|
||||
• The bot deletes its own confirmation message after 5–10 seconds
|
||||
• Do NOT delete immediately (clients need time to process the keyboard reset)
|
||||
|
||||
If deletion fails (permissions, race condition), the bot must silently continue.
|
||||
|
||||
What the bot must NOT do
|
||||
The bot must NOT:
|
||||
|
||||
• Store data
|
||||
• Track users
|
||||
• Use a database
|
||||
• React to normal messages
|
||||
• Remove inline keyboards
|
||||
• Delete other bots’ messages
|
||||
• Re-send keyboards
|
||||
• Perform scheduled actions
|
||||
|
||||
This is a stateless utility bot.
|
||||
|
||||
EDGE CASES AND EXPECTED BEHAVIOR
|
||||
|
||||
• If another bot sends a keyboard after this bot runs, that keyboard will appear again. This is expected.
|
||||
• If a user does not receive the message (offline/network), their keyboard may persist until the next reset.
|
||||
• This is the only technically correct way to reset keyboards in Telegram.
|
||||
|
||||
IMPLEMENTATION CONSTRAINTS
|
||||
|
||||
Update handling
|
||||
Either polling or webhook is acceptable.
|
||||
|
||||
Polling is preferred for simplicity.
|
||||
|
||||
Libraries
|
||||
Any official or widely used Telegram library is acceptable, such as:
|
||||
|
||||
• python-telegram-bot
|
||||
• aiogram
|
||||
• Telegraf (Node.js)
|
||||
• Raw Bot API (HTTP)
|
||||
|
||||
No unofficial wrappers.
|
||||
|
||||
Permissions required
|
||||
The bot must be granted:
|
||||
|
||||
• “Read messages”
|
||||
• “Delete messages” (optional, only for cleanup)
|
||||
|
||||
No admin rights beyond this are required.
|
||||
|
||||
LOGGING AND ERROR HANDLING
|
||||
|
||||
• Log startup success
|
||||
• Log command usage with chat ID and user ID
|
||||
• Log authorization failures at debug level
|
||||
• Fail silently on Telegram API errors (do not spam the group)
|
||||
|
||||
SUCCESS CRITERIA
|
||||
|
||||
The bot is considered correct if:
|
||||
|
||||
• An admin sends /resetkeyboard in a group
|
||||
• All visible reply keyboards disappear for users in that group
|
||||
• The bot does nothing else
|
||||
Reference in New Issue
Block a user