Welcome to the KTU Bot! This Telegram bot helps students check their exam results, find latest KTU notifications, academic calendars, exam time tables and alert users when new notifications arrive.
Find the bot here
- Check Results: Easily check latest published KTU results.
- Check old results: Check any results ever published in the history of KTU (yeah for real).
- Download published KTU notifications: Browse and download any published KTU notification.
- Dowbload published academic calendars: Browse and download any published KTU academic calendars.
- Download published exam time tables: Browse and download any published KTU exam time tables.
- Subscribe to latest KTU notifications: Get alerted when new notifications arrive.
- Filtered notifications: Only recieve notifications that you care about. No trash.
- Live search notifications: Search and download published notifications using the keyword.
-
/start
: Start the bot and get a welcome message. -
/help
: Show a help message with available commands. -
/result
: Fetch your exam results. -
/olresults
: Fetch previously published exam results. -
/notifications
: Find and download latest KTU notifications. -
/calendar
: Find and download published KTU academic calendars. -
/timetable
: Find and download published KTU exam time tables. -
/subscribe
: Subscribe to recieve latest KTU notifications as they arrive. -
/unsubscribe
: Unsubscribe from recieving KTU notifications. -
/changefilter
: Change currently set notification filter. -
/cancel
: Cancel ongoing process. -
/code
: See project source code.
Use inline query to live search the notification you want to. No more pain of scrolling through the webpage for the notification.
eg: @ktu_results_bot calendar : This returns all the results that matches word "calendar" like Academic calendars etc.
Note
The bot makes use of BullMQ, a redis based NodeJS queue, for the live notifications feature. Thus, it requires you to have a redis instance running. The docker compose method below already does that for you.
-
Install Node.js and npm on your machine.
-
Clone the repository:
git clone https://github.com/devadathanmb/ktu-bot.git
-
Navigate to the project directory:
cd ktu-bot
-
Install dependencies:
npm install
-
Set up your Telegram bot token:
-
Create a new bot on Telegram using the BotFather.
-
Copy the bot token.
-
Create a
.env
file in the project root and add:BOT_TOKEN="your-telegram-bot-token"
See env.example file for example
-
-
Create a Firebase project and setup a Firestore database in Firebase console
-
Download the
serviceAccountKey.json
file,minify
it andbase64
encode it usingjq -r tostring serviceAccountKey.json | base64
-
Copy the
base64
encodedserviceAccountKey.json
string to.env
FIREBASE_SERVICE_ACCOUNT="base64 encoded string"
-
Set the
ENV_TYPE
variable toDEVELOPMENT
in.env
ENV_TYPE="DEVELOPMENT"
-
Build the bot:
npm run build
-
Start the bot:
npm run start
-
Install Docker and Docker Compose on your machine.
-
Clone the repository:
git clone https://github.com/devadathanmb/ktu-bot.git
-
Navigate to the project directory:
cd ktu-bot
-
Create a
.env
file in the project root and add:BOT_TOKEN="your-telegram-bot-token"
-
Create a Firebase project and setup a Firestore database in Firebase console
-
Download the
serviceAccountKey.json
file,minify
it andbase64
encode it usingjq -r tostring serviceAccountKey.json | base64
-
Copy the
base64
encodedserviceAccountKey.json
string to.env
FIREBASE_SERVICE_ACCOUNT="base64 encoded string"
-
Set the
ENV_TYPE
variable toDEVELOPMENT
in.env
ENV_TYPE="DEVELOPMENT"
-
Make sure to add all necessary environment variables to
.env
mentioned in env.example -
Run the application using Docker Compose:
docker-compose -f docker-compose.dev.yml up
The bot should now be running and accessible on Telegram.
Note
The bot will automatically pickup changes in ./src
and restart the bot.
This bot makes use of Telegram bot API's webhook mechanism in production.
This is because of certain performance benefits that webhook offers with high concurrent load during peak times. For more info see this.
Note
Using webhooks in production is optional but recommended if your bot has heavy concurrent traffic. If you don't want to setup webhooks, just follow the above development setup guide and you are good to go.
To run the bot using webhooks in production, some pre-requisites are required. They are mentioned below:
- A VPS
- A domain
- SSL certificate for the domain (you can use let's encrypt for that)
- Docker
- A reverse proxy (like nginx)
Note
The below guide makes use of nginx as the reverse proxy and assumes that you have reverse proxy configured for the webhook endpoint with HTTPS traffic handling
-
Set up an nginx reverse proxy for the webhook endpoint. See this for more information. Checkout basic example in webhook.conf
-
Clone the repository using
git clone https://github.com/devadathanmb/ktu-bot.git && cd ktu-bot/
-
Set
ENV_TYPE=PRODUCTION
in.env
file. See env.example -
Make sure to add all necessary environment variables to
.env
mentioned in env.example -
Build and run the docker using
docker compose up -d
-
Start the nginx server (eg :
sudo systemctl restart nginx
)
That's it. Your bot should be running now in webhook mode.
If you encounter any issues, have feature suggestions, or want to contribute to the project, please feel free to fork and make a PR.
If you find any bugs or have feedback, please open an issue on GitHub.
This project is licensed under the GPL 3.0 License - see the LICENSE.md file for details.