Why i started to develop Telegram Bots


🤖 Introduction

What is Telegram?

Maybe you don’t know what is Telegram (stoopid), so I’ll tell you very briefly: Telegram is a real time messaging platform like Whatsapp, but better for a lot of things.

This is not the place to keep talking about it. I suggest you to use it specially if you are a programmer (follow @PavelDurov).

And so, what is a Telegram Bot?

A Telegram Bot is a Bot (wow) that can automate chat between it and the end-user and can be programmed to execute commands and everything that crosses your mind, from simple bots, starting from @likebot to complex bots like @R6SiegeStatsbot (it’s mine!).

Why did I choose Telegram instead of other platforms to work with Bots?

If you think about it, you can notice that Whatsapp, Facebook Messenger, iOS/Android App and other platforms are full of developers and bots so why shouldn’t I search for a less explored platform?

After a bit of research I found Telegram, but I haven’t found as much content as I was expecting. So I decided to work using Telegram not giving a damn about the lower user count compared to Whatsapp and the other platforms.

Some months later I noticed that I have made the right choice.

💻 Development

Operative systems, tools and libraries

When I started to work with bots I was 18, so my knowledge of operative systems and tools was a bit poor, but in a sunny morning I decided to buy a cloud machine from OVH and I started doing some experiments.

Then I searched for a nice programming language and a library (a module), so I picked Node JS and Telegram Bot API for NodeJS, because JS is a harmful language and I was very brave at the time.

Currently that module is not very up-to-date, so if you want to follow my steps, I suggest you to pick Telegraf or something similar.

After some headache from installing and configuring nginx for serving multiple bots, pm2 to manage processes and aws s3 to backup, my workspace grew up in the following months and became a stable system


Maybe this is the most important part of this story: Ideas 💡.

This part of a creative path is sometimes understimated, cause people generally go straight by working on a project without a defined ideas, and sometimes they stuck on a point where ideas are finished. But this is not totally wrong. Is difficult start a project with a totally defined path, specially if your are alone and not with a solid team.

Anyway, i think that a valid way could be think about an idea that is not too big and not too small, so you will not waste too much time for a big idea that not works, and not stuck yourself with a small idea cause you have limited it.

Then in the next weeks i noticed a very stupid and useless bot that insults people that write to it and i tought: why don’t start with learning a simple bot by copying this easy bot? So i used next days/weeks to work on a stupid (but for me, useful) bot.

Then i deleted that bot (yes, also git and sources, so i can’t show you…) and i started working on a game bot: LootBot, unfortunately only in italian language for now, maybe in future also english people will enjoy it.

I wanted to develope a game bot cause not so much games was available on Italian Telegram, so where is a opportunity i started working on that.

Loot Game Bot

Like my first bot, this one was born like a clone of another, with a gameplay that substantally consisted in a player that go to missions, wait some times, and then rewarded with a chest. Then he open the chest, found an item, and craft more items to make different items, and loop like that.

The first news that makes different from all other game bots was the combat system, craftable weapons and bosses to kill. Then travels, team, dragons, dungeons, weekly events, assaults, dragons battles and at least a battle royale mode (maybe are you saying wtf?!).

And then, after 4 years, almost 70.000 line of code, Loot Bot has raised 30.000 registered players. A very nice goal.

Other bots

Simoultaneosly, i worked at different and interesting bots, i created a Rainbow Six Siege group (with 2.500 users in almost one year of activity) and a bot for see game stats (@R6SiegeStatsbot). The bot was primary element to group grow, users use 24/7 that bot in that group, in other groups and in private mode. Now i have 2.200 game account registered, 100.000 stats saved and 60 different groups.

You can take a look in the source code here: GitHub and maybe get some inspiration for your project if you have a similar idea.

Anyway, i worked on some bots too, smaller than R6 and Loot, but useful for someone maybe.

Authorizatorbot born from a need of filter users that access a public group, by asking to complete some actions like set username, profile pic, complete a captcha, click an inline button, set a specified language or have a recent account. These action should prevent user bots and lazy people to join your group. Is not wide tested, but the system should work fine for all groups.

Take a look in the source code: GitHub

Then for inlineMathbot, Compactorbot and UserStatsTrackerbot there is not so much to say: inline math allow you to make advanced math using (math.js) with Telegram’s inline mode; compactor bot merge all consecutive messages from the same person in to one (very useful for massive people that can’t write in a single message); and user stats tracker simply memorize how many messages are sent in all groups where the bot is and make some simple statistics usable also inline.

All sources can be found here: GitHub

Open source or not?

Every programmer has own different ideas to how this process should be, would i make public or non-public my source code?

I have a simple idea about that: you should make public only things that can’t be stolen. So i keep public TelegramBots sources and not LootBot. Because obviously, developing a game make easy for people to look for make a copy by stealing the code.

Probably, when the game will not be played anymore, i’ll make public with his repository.

This leads to the (maybe) most important topic… and the profit?

💰 Profit and conclusions

You get a monthly salary with Telegram Bots?

Short: No.

Long: No but, something. Telegram is not a way to sell something, you can’t use usual methods to get money, sponsor banners are not (automatically) supported, games and tools have not graphical content so you can’t make DLC or something visual.

So you must find different ways like donations (payments, supported by Telegram) or sponsorizations if you have very high volumes of people. But i need to say a personal idea about that: i think that you shouldn’t make this type of project a source of salary, cause Telegram is not a platform for making real services, there are too many limitations, too little platform stability. So is not worth, for my point of view.

Maybe, if you make a support bot for an e-commerce, you should use it a source of salary, but only for a part of it.


For put an end to this long story i would make a summary of the concept i think i learned in this last 4 years.

  • I’m a curious developer, i searched for something interesting, i found it, i spent 20+ hours/week to works on it and i don’t regret it.
  • I searched for learning something about Unix systems, in this way i have learned a lot by self-learning.
  • I managed communities, i learned to deal with lots of people, with their problems or suggestions.
  • I have made new friends and work contact, this has been useful for my work sphere and for communication.
  • I have not got so much money, at least for server maintenance, but it was not my objective, i don’t regret it.

At the end, the key phrase can be something like: if you think something is good for you more than is bad for you, you must do and you will not regret. You will learn a lesson in both cases.

Thanks for reading! If you see something not so much clear, bad formatted or broken links, contact me and i will fix asap!

comments powered by Disqus