This is a Telegram bot written in Python that generates an HTML file or a text message for a student's marks based on their ID number in Albaath-Universty - IT College.
This project is a modular bot, made using Python 3 and the following libraries:
The bot scrapes a student marks table and converts the list of students' marks into an HTML table. For example:
The list of students' marks will look like this in HTML:
- The bot allows the user to obtain an HTML file of a single student's marks by providing their ID number using the
/html
command. - The bot also sends a normal text message of a student's marks to the user.
- The bot can also generate an HTML file of all students whose ID numbers are within a certain range using the
/in_range
command. - The bot can work in inline mode, so you can type your bot username then the ID number of a students (you should enable inline mode in your bot from @BotFather settings > Inline Mode > Turn on).
Before you use this bot, you need to have:
- A working Telegram account.
- A bot token, which can be obtained by talking to BotFather on Telegram.
-
Clone this repository to your local machine.
git clone https://github.com/ObaidaNa/albaath-marks.git cd albaath-marks
-
Add your bot token to the
config.json
file. -
Install the required packages using the following command:
pip install -r requirements.txt
-
Run the bot:
python source/main.py
Notes:
- You can change the start message in the
config.json
file.- Also you can specify the html file caption (when it sended to the user) and the HTML sign (which appears on the top of the HTML file)
- Environment variables have a priority over the
config.json
file variables, so you can leaveconfig.json
empty and only pass environment variables instead.- To convert an HTML file to PDF, here's some websites I've tested and was working fine with Arabic:
If you would like to contribute to this project, feel free to submit a pull request. All contributions are welcome and appreciated!
This project is licensed under the MIT License.