A feature-rich Telegram bot for hosting interactive quiz shows and buzzer competitions with real-time scoring and leaderboards.
- Instant Buzz Detection: Real-time buzzer with millisecond-precision timing
- Auto-Reset: Automatically resets 20 seconds after the first buzz (if no manual lock)
- Cooldown System: Prevents rapid, consecutive buzzes from the same user
- Photo Finish Detection: Alerts when two participants buzz within 1 second of each other
- Pinned Buzzer: Active buzzer is pinned to the top of chat for visibility
- Per-Chat Scoreboard: Independent scores tracked for each chat
- Jeopardy-Style Scoring: Admin-controlled point adjustments (+/- 100 to 1000 points)
- Live Score Changes: Displays up to 3 recent score changes per round
- Final Scoreboard: Send a ranked final scoreboard at the end of a game session
- Streak Tracking: Tracks buzzer winning streaks with milestone celebrations
- Start Game (
/start): Initialize a new buzzer for the round - Lock ๐: Lock the buzzer after all participants have buzzed (prevents late buzzes)
- Unlock ๐: Clear all buzzes and start over
- Reset ๐: End game session and display top 3 players by streak
- Finish Game ๐: Send a final ranked scoreboard
- Manage Scores: Click participants on the scoreboard to adjust their points
- Responsive Buttons: Instant feedback on buzz attempts
- Banter Messages: Random flavor text on late buzzes and unlocks
- Live Feed: See all buzzes displayed with delta times in real-time
- Participants List: Auto-generated list after each round reset
- Python 3.10+
python-telegram-botv22.xpython-dotenvAPScheduler(via python-telegram-bot's job queue)
-
Clone the repository (or set up your workspace):
cd /home/pi/buzzingaTgBot -
Create a virtual environment:
python3 -m venv .venv source .venv/bin/activate -
Install dependencies:
pip install python-telegram-bot python-dotenv
-
Configure environment variables: Create a
.envfile in the project root:BOT_TOKEN=your_telegram_bot_token -
Set admin IDs: Edit
buzzingaTgBot.pyand updateADMIN_IDSwith your Telegram user IDs:ADMIN_IDS = { your_user_id_1, your_user_id_2, }
-
Create
labels.py(if missing) with your custom message strings. See the imports inbuzzingaTgBot.pyfor required keys. -
Run the bot:
python buzzingaTgBot.py
- Send
/start(admin only) to initialize a new buzzer - A pinned "Ready to buzz!" message appears at the top of chat
- Participants press the Buzz button to register their response
- The bot displays the order and timing of all buzzes
- Multiple buzzes show delta time from the first buzz (e.g., "+0.234s")
- Lock ๐: Prevents further buzzes; shows the fastest participant as "Fastest"
- Unlock ๐: Clears buzzes and resets for a new round (keeps the same chat active)
- When the buzzer auto-resets (20s after first buzz), a Scoreboard is automatically sent
- Admins click a participant's name to open the points menu
- Select a point value to add/subtract (grid of +100 to +1000 with negative variants)
- Score changes appear at the top of the scoreboard (newest first, up to 3 recent changes)
- Format:
Name +pointsorName -points(e.g.,Spidy +1000)
- Reset ๐: Shows the top 3 streak leaders and resets the game session
- Finish Game ๐: Sends a final ranked scoreboard (does not reset other data)
| Button | Action | Notes |
|---|---|---|
| Buzz | Register your response | Instant feedback; cooldown prevents spam |
| Finish Game | Send final scoreboard | Admin only; shows all scores ranked |
| Button | Action | Notes |
|---|---|---|
| Buzz | Still available | Users can still see the state (read-only) |
| Reset ๐ | End round, show leaderboard | Admin only |
| Button | Action | Notes |
|---|---|---|
| Reset ๐ | End round | Admin only |
| Action | Effect |
|---|---|
| Click participant name | Open points menu for that user |
| Click point value | +/- that amount; updates scoreboard immediately |
| Click ๐ Back | Return to main scoreboard without changes |
- Initial Score: All participants start at 0
- Point Adjustments: Admin can award/deduct points in increments
- Points Grid (4 columns ร 5 rows):
+100 -100 +200 -200 +200 -200 +400 -400 +300 -300 +600 -600 +400 -400 +800 -800 +500 -500 +1000 -1000 - Change Log: Only the 3 most recent score changes are shown (cleared on next auto-reset)
Only users in ADMIN_IDS can:
/startโ Initialize a new buzzer- Lock ๐ โ Lock the buzzer
- Unlock ๐ โ Unlock and reset buzzes
- Reset ๐ โ End game session
- Modify Scores โ Click scoreboard buttons to adjust points
- Finish Game ๐ โ Send final scoreboard
Non-admins attempting these actions receive an alert: "
PHOTO_FINISH_THRESHOLD = 1.0 # Seconds; buzzes within this are marked as "photo finish"
BUZZ_COOLDOWN = 0.3 # Seconds; minimum time between buzzes from same user
MAX_CHANGE_LINES = 3 # Max recent score changes shown per scoreboardAll user-facing messages are defined in labels.py. Customize text, emojis, and banter there.
- First Buzz: "โจ You got the fastest finger!"
- Late Buzz: Random message from
LATE_BUZZ_MESSAGES(e.g., "โฐ Too slow!") - Photo Finish: "๐ธ PHOTO FINISH!" (buzzes within 1 second)
- Locked State: "๐ Buzzer is locked. No more buzzes accepted."
- Unlock Banter: Random flavor text when returning to an unlocked state
- Milestone Popups: Celebrations at 5, 10, 15 buzz streaks
- Score Changes: "Spidy +1000" (displayed in scoreboard)
- Logs: Check
buzzinga_bot.logfor full event history with timestamps - Console Output: INFO level logs also print to stderr
- External Logs Suppressed:
httpxandtelegramlibrary logs set to WARNING to reduce noise
- Expired Buzzer: Reinitialized on first buzz after bot restart
- Failed Edits: Previous scoreboard cleanups logged as DEBUG (non-fatal)
- Network Issues: All message edits wrapped in try/except; errors logged
The bot is designed to run on a Raspberry Pi (tested on Pi 4). Ensure:
- Python 3.10 is installed
- Virtual environment is activated before running
.venvdirectory is set up with all dependencies.envfile has correctBOT_TOKEN
[Admin] /start
โ Buzzer initialized and pinned
[User A] Presses Buzz
โ "Fastest finger! โจ"
[User B] Presses Buzz (+0.234s)
โ Fuzzer shows both with timings
[Admin] Presses Lock
โ Buzzer locked; "User A" marked as Fastest
[20 seconds auto-reset]
โ Participants list sent
โ Scoreboard sent with empty changes
[Admin] Clicks "User A"
โ Points menu opens
[Admin] Clicks "+1000"
โ Scoreboard updated: "User A +1000" + live ranks
[Admin] Presses Finish Game
โ Final scoreboard sent (no more scoring allowed)
All code is provided as-is for personal use.
For issues, check buzzinga_bot.log and ensure:
- Bot token is valid and environment is activated
- All required imports are installed
- Admin IDs are correctly set
- Chat has appropriate permissions for pinning messages
Version: v1.1 (Final, pin-fixed)
Last Updated: February 15, 2026