New Telegram bot for shackspace status updates and basic chat interactions.
The bot:
- fetches door state from the shackspace API,
- answers direct commands in Telegram,
- reacts to mentions in group chats,
- posts periodic state-change notifications.
shacki_tbot.py- main bot application.README.md- this documentation.
- Python 3.10+
- Telegram bot token
- Internet access to
https://api.shackspace.de/v1/space
Python dependencies used by the code:
python-telegram-botrequestspytz
Example install:
python3 -m venv .venv
source .venv/bin/activate
pip install python-telegram-bot requests pytzRuntime arguments:
--token(required): Telegram bot token (critical info, so is not contained in this repo).--developer(optional): developer contact id shown in unknown command replies.
Recommended:
source .venv/bin/activate
python3 shacki_tbot.py --token "<your_token>" --developer "<developer_contact_or_id>"/start- welcome message./help- command list./doorState- current cached door state (with friendly hint)./doorStateDetailed- current state plus previous state and timestamps./plenum- placeholder response./version- bot version string.
Unknown commands are handled with a fallback response.
- Private chat: responds to plain text messages.
- Group/supergroup: responds only when the bot username mention (
@shacki_bot) is present. - Includes simple keyword-based replies (
hello,ping,door, etc.).
- The bot calls
https://api.shackspace.de/v1/space. - Reads
doorState.openfrom the JSON response. - Converts it to
open/closed. - Stores timestamps in
Europe/Berlintimezone. - On state change, publishes notifications to configured groups.
Error cases are stored as Unknown: ... states and logged.
- Do not commit real bot tokens to git history.
- Prefer environment variables or secret management for production deployments.
allowed_updates=[]in polling receives all update types, which may be broader than needed.- Conversation logic is intentionally simple and keyword-based.
- API/network failures are surfaced as
Unknownstate instead of retries with backoff.