Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

112 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Power Interruption Bot

This python telegram bot displays locations in 🇰🇪 where power outages are expected to occur in the near future.

Functionality

Once a week, the bot parses the KPLC website and gets the most recent PDF with a list of the places that will be affected by the scheduled power outage.

Following that, data is extracted from the pdf and saved to a text file.

Unneeded information is eliminated from the text file, and the remaining information is formatted as a nested dictionary and saved to Redis. The code contains the specifics of how everything functions.

Important Packages Used

  • Python-telegram-bot --> An interface to interact with the python API.
  • Regex module --> Mahorly used to remove unnecesary text from the data extracted from the pdf.
  • Textract --> Extracts data from the pdf doenloaded.
  • Redis --> saves the nested dictionary.
  • Boutiful Soup --> parses the kplc website and doenloads the latest pdf.

How To Install Locally

  • Create a folder to store the code
  • At the terminal clone the repo git clone https://github.com/n3tsploit/PowerOutage-Bot.git or download the zip file of the code.
  • inside the telebot folder create a .env file containing the API token of the telegram bot gotten from Bot father.
  • start the bot by running the run.py file.

How To Use The Bot

You can get a working prototype of the bot here https://t.me/planned_power_outage_bot .

Demo

https://www.loom.com/share/866e866f1f1d41019492f75e752f8651

Features to add

  • Add an alert feature in which users will be notified if there is power interruption schduled in their county.

PS:Built for educational purposes, and it might contain outdated/erroneous information.

About

This is a python telegram bot that shows you areas in 🇰🇪 that are scheduled for power interruption within a certain period of time.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages