Kawaii Ninja

Creating A Telegram Bot


I started using Telegram back in 2016, when I first joined the app to become a part of a custom ROM community. Years went by, and I stayed loyal to the messaging application, using it every single day, installing it on all of my devices. Even though none of my friends were on it to chat with in the first place. I then slowly told some of my close friends to join and showed them some best of best features of Telegram compared to WhatsApp. Fast forward to 2022, some of them joined but for a single reason only, Piracy. Even I use the platform sometimes to pirate the stuff, which is not available in my country freely. That’s another topic to discuss altogether.

Telegram Bots play a major role in Telegram groups, they not only help in blocking spam users from joining public groups but also provide some additional functionality to the group. So far I have used a lot of them during my last 5 years on the app. But, I always had a thought to create my very own bot for my own needs. I started off by hosting other bots for my private use but never managed to create my own, but that changed this year.

Titans Are Coming Back

“Nothing can suppress a human’s curiosity.” – Eren Jaeger

Attack on Titan is currently airing it’s final season, and I have a tendency to forgot about which anime aired on which day. Most of the time I ended up watching the previous episode, which I had seen already once again. In order to combat this situation, I decided that I would make something to check if the new episode is aired or not.

Here comes piracy again into the picture. Attack on Titan can’t be seen in my country legally, so I don’t have any other choice then depending on torrent sites. Now, that’s out of the picture, let me tell you the whole process.

Episode Data

When you want to track some torrent, you have to use RSS feeds. Most of the torrent clients will happily download the stuff for you automatically. That’s nice, but I don’t want that because I have other means to download the torrent content from elsewhere.

I got the RSS feed which I was looking for to track. But, the challenge here is how the heck I’m supposed to use RSS feed without a RSS client. Now, RSS to JSON converter comes into the picture. I found a service online which does exactly that by providing an API endpoint. Okay, now I have my data, the only thing left is to check this data using some sort of a front-end.


I could easily use the bash script to fetch the required data, but I use my phone more often than my laptop. Next in line where website and Telegram bot, website would take some time to build and host so, I ruled it out from the list. As I have told earlier, my wish to create my own Telegram bot, and here is my golden chance to do so. But, wait a moment, I don’t know how to create one in the first place.


I quickly found a python wrapper for Telegram bot creation, since I know a bit of python already, I could easily pull off the strings and complete my mission. After few hours of trial and error, I finally managed to do what I set out to achieve. My bot was ready, I was so happy that after more than 5 years of usage I have my own bot which works only for me.


That’s cool that I managed to created my own bot. But, it was lacking features to use often. I then read the wrapper examples and also watched some YouTube tutorials to add some other functionality to the bot. I ended up with two functions, one to get any anime’s latest episode and the other to get the batch of any anime.


So far I’m happy that I was able to create what I wanted to do. Even though my code is messy, I still like my project. For me programming is not all about solving complex problems, I want to enjoy every bit of the process no matter the complexity of the problem.

This is the Day 9 of 100DaysToOffload challenge (Round Two)