The Minecraft Timer now uses one-tap Telegram button approval instead of code entry. Parents can approve or deny time extension requests with a single button tap.
- Parent received 4-digit code via Telegram
- Child had to enter code manually (3 attempts)
- More steps, more friction
- Parent receives message with [✅ Approve] and [❌ Deny] buttons
- One tap = instant approval or denial
- Child just waits (no code entry needed)
- Message updates to show "APPROVED" or "DENIED" status
- Inline Keyboard Buttons: Telegram inline_keyboard with callback_data
- Long Polling: Script polls Telegram API every 5 seconds for button clicks
- Python JSON Parsing: Robust parsing of callback data (handles Unicode/emojis)
- Webhook Clearing: Ensures polling mode is active (not webhook mode)
- Unique Request IDs: Each request has unique ID to prevent conflicts
- Child clicks "Ask for More Time"
- Script sends Telegram message with inline keyboard buttons
- Script disables webhooks and starts polling for updates
- Parent clicks button in Telegram
- Script receives callback_query, validates REQUEST_ID
- Script acknowledges callback and updates message
- Time granted or denied accordingly
- Timeout after 5 minutes (60 polls × 5 seconds)
- Fallback to admin password if denied/timeout
- Skips old/unrelated callbacks
- Error detection for webhook conflicts
minertimer.sh- Main script with button approval logictest_telegram.sh- Test script updated for buttonsREADME.md- Documentation updated
✅ Debug output removed ✅ Error handling in place ✅ Webhook conflicts handled ✅ Unicode/emoji parsing fixed ✅ Proper offset management ✅ Callback acknowledgment ✅ Message status updates
Run: ./test_telegram.sh
This will:
- Send real Telegram message with buttons
- Wait for parent to tap button
- Show approval/denial flow
- Test fallback password if needed
- Python 3 (for JSON parsing)
- curl (for Telegram API)
- Telegram bot in polling mode (not webhook)