[☰][2018-03-30]hacks:telegram-cli mods

Experiment with telegram

I'm on my second week of trying out the Telegram service. It's been going on quite well with the exception of a few hours downtime this week. The official explanation is that the service is growing so fast they could barely keep up and a major data center had a power outage. It sounds resonable. Feature wise it's pretty much 1:1 mimic of fb messenger. This means beside sending text - webpage previews, sending photos, videos, files. Still no webm stream support! I think fb converts them to mp4 as soon as they are shared. The more interesting part is the exposed APIs and open source clients. This gives people like me a playground for experimentation and a promise of much more automated chatting. Example is forwarding media to multiple groups - in fb I would have to click around. It's shit. Here you have a way to make your own script and use it to send to all those groups with a single command. Talking specifically about tg here. So far it has been really stable even with me messing around with it.

Bugs

First few days I noticed a bug while trying to change my profile pic. In the tgl library in queries.c in send_avatar_end function there is

out_int (CODE_photos_upload_profile_photo);

and it's written twice. Comment one of the lines and you'll be able to change the photo.

Modifications

It seems tg has some scripting abilities - python and lua. While this is great I couldn't find how to make script changes be loaded on-the-fly and not only in the beginning not to mention language independence. So my plan was to make it possible to call a script from the cli and pipe its output back to the cli. Kinda how WSGI works. With the help of execv there is now the "!" command. Say you want to turn the string 'aaa' into 'a a a' You could call:

! space my_group aaa

where space is a bash script/C program/anything callable and aaa is the argument. I still can't figure out variable arguments, but I'll add them soon I hope. You can get the project here.

share:[twitter][reddit][linkedin][g+]