Konata Telegram bot :3
 
 
Go to file
Michael De Roover e19a81b331
Remove COVID-19 code
2024-03-22 04:20:56 +01:00
index.html Make the status page black themed 2020-12-28 02:56:22 +01:00
install.sh Make installer idempotent 2022-04-06 01:32:04 +02:00
konata.sh Remove COVID-19 code 2024-03-22 04:20:56 +01:00
lighttpd.conf Move mimetype assignment into lighttpd.conf 2021-05-20 23:38:57 +02:00
readme.md Update links 2021-04-21 01:34:02 +02:00

readme.md

Konata the Telegram bot

This project contains the source code of the Telegram bot @konatasanbot, the sister project of ghnou/ubot. It is the code you need to make her run, although this is only a small part of the actual appliance.

Most importantly, you need a public domain name, a TLS certificate for it and a stable webserver to run this bot. The installer assumes that you do have this webserver already deployed (personal website or similar), that your domain is configured and that your webserver is what terminates TLS and reverse proxies incoming requests to the bot. The bot's system should be Alpine, and I recommend using LXC to build it into a container.

While this sounds complicated, it's not really all that difficult to do. I will not document this however and you should look it up if you don't have these already. Which brings me to the allowed usages for this bot's source code.

License

This project is released as "All rights reserved". You are allowed to use and study the code as inspiration to make your own bot, but you are not allowed to copy it verbatim into a release of your own.

Bot weight

This bot has been made in an attempt to replace bots written with Telethon, Pyrogram etc. I used to run a userbot based on Telethon, but the code was very arcane and heavyweight. It wasn't easy to keep it up-to-date either, and vulnerabilities were common. My account on Telegram has too much access for this to be reasonable. As such I tried to move all of the features I would use in my userbot / other bots into this one. And it works out well! At the time of writing, Konata consumes ~5MB RAM and ~85MB storage for the entire Alpine container it runs in.

Why bash and CGI?

The reason for this is that it's simply my native programming language. It is normally not considered a suitable language for dealing with API's, due to escaping needs. Well.. MarkdownV2 on Telegram already causes that issue, while the tokens (which usually cause issues) are reasonable. It's alphanumeric with a single : somewhere in between. CGI and bash is also fairly common in embedded systems (routers and such), as such it is lightweight. It has to be that way. And that is why I like it for these purposes. Just because it's uncommon doesn't mean it's bad.

Limitations

Currently this bot is not asynchronous. A command comes in, the bot executes it, and all other commands will be queued until the current one is finished. I am working to improve this. It could be done either by using FastCGI, or by adding multithreading support in the main script. Both have their advantages and disadvantages. I am still undecided on what I wish to go with.

Contributing

I hope you'll like using this bot, and learn about the various ways you can run one. If you have any features you'd like to see, feel free to open a pull request along with code against this repo. Please make sure to follow the existing coding standards (i.e. case statement, functions, tab indentation etc) when contributing your own.

Enjoy!