A minimal Telegram AQI notification bot
The latest version uses Cloud Firestore as the persistent storage backend. The original in-memory version can be found in the in-memory branch.
You need to provide two environment variables:
- AQI_TOKEN
- BOT_TOKEN
And save your service account JSON keyfile from Google Cloud as keyfile.json
in the root folder.
Get your token from aqi.cn.
Get your token from @BotFather
This bot uses collection named subscriptions
, and use the chat_id
as key.
The free tier should be more than enough to cover the read/write from this bot. However, currently we haven't implemented anti-abuse mechanisms. Be extra careful if you've enabled billing for your project.
We provide a simple Dockerfile and sample docker-compose.yml for you to get started.
Please do not abuse this service (excessive /set, /unset, or /get commands).
/find <lat> <lng>
Use the station id from /find
.
/set <station_id>
/unset
Adjust behaviors according to the pollution level.
Sometimes the update from an station can be delayed for more than 20 minutes(the maximum allowed delay in the current setting). Need a retry mechanism.