Skip to content

kkaya674/ASKI-Water-Outage-Watcher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASKİ Water Outage Watcher 💧

This project periodically checks the official ASKİ outage page and posts updates to a Telegram forum (Topics) supergroup.
It sends a message only when something changes (new/updated outage entry) and posts into the correct district topic. If the topic does not exist yet, the bot creates it automatically.

Setup (Virtual Environment)

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Telegram Configuration 🔐

Create a .env file in the project root (see .env_example) and fill in: TELEGRAM_BOT_TOKEN TELEGRAM_CHAT_ID (your forum supergroup id, e.g. -100...) Load it into your shell:

source .env

(Optional) Get group update info

Useful for debugging group/topic updates:

curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"

Run the Bot 🚀

Run as a daemon (poll every 10 seconds):

python3 water_watch.py --daemon --interval-sec 10 --state-dir state --topics-file topics.json

Notes

state/ stores per-district “already sent” outage ids to avoid duplicate notifications. topics.json stores the mapping: DISTRICT -> message_thread_id (topic id). Your Telegram group must be a Topics-enabled (forum) supergroup, and the bot should be an admin.

To run the bot as a background process, you can use screen.:

screen -S water_watch
source .env
./.venv/bin/python3 water_watch.py --daemon --interval-sec 10 --state-dir state --topics-file topics.json
# To detach from screen session: Ctrl+A D
# To reattach: screen -r water_watch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%