telegram-cli

Rating: 
3.666665
Your rating: None Average: 3.7 (9 votes)

Telegram messenger CLI

Command-line interface for Telegram. Uses readline interface.

API, Protocol documentation

Documentation for Telegram API is available here: http://core.telegram.org/api

Documentation for MTproto protocol is available here: http://core.telegram.org/mtproto

NOTE: This is a SailfishOS compilation of unofficial Telegram Cli for Linux created by vysheng at https://github.com/vysheng/tg

USAGE:

$ telegram-cli

Client support TAB completion and command history.

Peer refers to the name of the contact or dialog and can be accessed by TAB completion. For user contacts peer name is Name Lastname with all spaces changed to underscores. For chats it is it's title with all spaces changed to underscores For encrypted chats it is <Exсlamation mark> Name Lastname with all spaces changed to underscores.

If two or more peers have same name, number is appended to the name. (for example A_B, A_B#1, A_B#2 and so on)

Supported commands

Messaging

  • msg <peer> Text - sends message to this peer
  • fwd <user> <msg-seqno> - forward message to user. You can see message numbers starting client with -N
  • chat_with_peer <peer> starts one on one chat session with this peer. /exit or /quit to end this mode.
  • add_contact <phone-number> <first-name> <last-name> - tries to add contact to contact-list by phone
  • rename_contact <user> <first-name> <last-name> - tries to rename contact. If you have another device it will be a fight
  • mark_read <peer> - mark read all received messages with peer
  • delete_msg <msg-seqno> - deletes message (not completly, though)
  • restore_msg <msg-seqno> - restores delete message. Impossible for secret chats. Only possible short time (one hour, I think) after deletion

Multimedia

  • send_photo <peer> <photo-file-name> - sends photo to peer
  • send_video <peer> <video-file-name> - sends video to peer
  • send_text <peer> <text-file-name> - sends text file as plain messages
  • load_photo/load_video/load_video_thumb/load_audio/load_document/load_document_thumb <msg-seqno> - loads photo/video/audio/document to download dir
  • view_photo/view_video/view_video_thumb/view_audio/view_document/view_document_thumb <msg-seqno> - loads photo/video to download dir and starts system default viewer
  • fwd_media <msg-seqno> send media in your message. Use this to prevent sharing info about author of media (though, it is possible to determine user_id from media itself, it is not possible get access_hash of this user)
  • set_profile_photo <photo-file-name> - sets userpic. Photo should be square, or server will cut biggest central square part

Group chat options

  • chat_info <chat> - prints info about chat
  • chat_add_user <chat> <user> - add user to chat
  • chat_del_user <chat> <user> - remove user from chat
  • rename_chat <chat> <new-name>
  • create_group_chat <chat topic> <user1> <user2> <user3> ... - creates a groupchat with users, use chat_add_user to add more users
  • chat_set_photo <chat> <photo-file-name> - sets group chat photo. Same limits as for profile photos.

Search

  • search <peer> pattern - searches pattern in messages with peer
  • global_search pattern - searches pattern in all messages

Secret chat

  • create_secret_chat <user> - creates secret chat with this user
  • visualize_key <secret_chat> - prints visualization of encryption key. You should compare it to your partner's one
  • set_ttl <secret_chat> <ttl> - sets ttl to secret chat. Though client does ignore it, client on other end can make use of it
  • accept_secret_chat <secret_chat> - manually accept secret chat (only useful when starting with -E key)

Stats and various info

  • user_info <user> - prints info about user
  • history <peer> [limit] - prints history (and marks it as read). Default limit = 40
  • dialog_list - prints info about your dialogs
  • contact_list - prints info about users in your contact list
  • suggested_contacts - print info about contacts, you have max common friends
  • stats - just for debugging
  • show_license - prints contents of GPLv2
  • help - prints this help
  • get_self - get our user info

Card

  • export_card - print your 'card' that anyone can later use to import your contact
  • import_card <card> - gets user by card. You can write messages to him after that.

Other

  • quit - quit
  • safe_quit - wait for all queries to end then quit

EXTRA DEPENDENCIES (they will auto resolve if you have the repo enabled):

libevent >= 2.1.11

libconfig >= 1.7.2

jansson >= 2.13.1

lua >= 5.3.5 (already available in default SFOS repos)

Keywords:

Application versions: 
AttachmentSizeDate
File telegram-cli-1.3.3-1.armv7hl.rpm2.46 MB11/01/2018 - 03:33
File telegram-cli-1.3.3-2.armv7hl.rpm2.53 MB14/01/2018 - 21:38
File telegram-cli-1.3.3-3.armv7hl.rpm1.31 MB12/06/2020 - 02:59
File telegram-cli-1.3.3-4.armv7hl.rpm1.31 MB12/06/2020 - 03:05
File telegram-cli-1.4.1-1.armv7hl.rpm1.31 MB13/06/2020 - 22:42
Changelog: 

* 1.4.1-1 compiled for SailfishOS 3.x (armv7hl) *The package is exactly the same like 1.3.3-4 but 1.4.1 is the real version of the telegram-cli being used.*

* 1.3.3-4 compiled for SailfishOS 3.x (armv7hl)

* 1.3.3-3 compiled for SailfishOS 3.x (armv7hl) *BROKEN DON'T USE*

* 1.3.3-2 compiled for SailfishOS 2.x (armv7hl)

* 1.3.3-1 compiled for SailfishOS 2.x without lua & json (armv7hl) *initial version*

Comments

carlosgonz's picture

Thanks for updating .

pamoedo's picture

Thanks to you also for testing ;)

BTW, I didn't know that someone was still trying to use this in SFOS 3.x, next time you see one package of mine out of date, don't hesitate to ask me for an update, I can't promise a quick response but for sure I'll try to do something.

Regards.

Kabouik's picture

I'm getting this issue on the Pro1 and SFOS 3.3.0.16:
"telegram-cli: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory"

pamoedo's picture

@Kabouik, I have recompiled all dependencies and telegram-cli source code within latest SFOS 3.3.0.16 and it works on my Xperia X again, please give it a try with version "telegram-cli-1.3.3-4.armv7hl.rpm"

Regards.

Kabouik's picture

Thanks for the update. Unfortunately the libevent dependency you packaged is not compatible with the latest tmux (see comments in the page of your libevent package). I'm not sure exactly why NielDK's version of libevent works fine despite being older than yours, but my tmux version is also up to date and it seems to require a .so file that is not included in your package.

pamoedo's picture

Hi Kabouik, I always compile every extra dependency that is not included by default within SFOS repos and I always go for the latest stable version (if any), after that I prepare the rpm with the corresponding dependencies that will auto resolve if you have my repo enabled avoiding manual intervention for the users and ensuring on this manner they have the same versions I have included in the crosscompiling environment.

FWIW, I have compiled myself tmux 3.1b with libevent-2.1.11 and ncurses-6.1 (already in SFOS) and it works perfectly, you can see it uploaded in openrepos.

One question, I've been able to see the following when configuring tmux sources:

checking for LIBEVENT... yes

When you compiled your tmux version, which version of libevent were you using? the 2.0 from NielDK? maybe that's the problem.

Regards.

Kabouik's picture

I probably compiled tmux with NielDK's libevent, you're absolutely right. I could upgrade that with your more recent libevent version and reupload the package (I used NielDK's because it was the latest available on Openrepos at the time). Probably a good idea to mirror libevent on my repo too to facilitate auto-installation of dependencies (as you said, it's more convenient from a user perspective).

However, we shouldn't upload concurrent packages of tmux that install the same tmux version, it's confusing and will cause headaches for users.

pamoedo's picture

Absolutely, please go ahead and recompile your tmux with latest libevent, if you need just copy my libevent package into your repository to enable auto resolution when installing your version of tmux. This is something openrepos should improve, cross-repositories dependencies, to avoid duplicating libraries everywhere.

Regarding concurrent packages, well, I'm afraid this is one the good things of open source, I don't think it will cause any harm to have multiple alternatives of the same application but like yours has more plugins what I will do is to put a note in my tmux version recommending yours instead and also change the type of mine to libraries, on this manner my tmux version will disappear from the main page of Storeman but still be searchable if needed ;)

Regards.

Kabouik's picture

Perfect! The issues we discussed earlier should now be fixed with the latest libevent I built and uploaded. Could you check if it does everything you need (I tested it with telegram-cli already and it worked, but not sure if you have other uses for libevent)? If yes, then could you reflect the update on your repository as well so that all users installing libevent automatically by installing either telegram-cli or tmux have the same dependency? It works already anyway, but I think having the same libevent dependency would avoid potential issues in the future.

pamoedo's picture

Being honest, I haven't touched this since SFOS 2.x, let me see if I can make it work, the original repo hasn't has new commits since 2016.

nyr's picture

Do not take phone number on Inoi R7

pamoedo's picture

Sorry, I have no manner to debug it for that phone, on my Xperia X is working as expected.

t0t3u's picture

Great job! Keep up the good work!

pamoedo's picture

Thanks.

ferlanero's picture

Wow! That's so fucking fast!! Many thanks for your efforts full porting Telegram CLI to SFOS, much appreciated!!! Absolute thumbs up!!

pamoedo's picture

;-)

ferlanero's picture

All what you say it's really cool. Would be fantastic if you could add all the capabilities add possible. Thanks again!

pamoedo's picture

Done! please update.

BTW, regarding lua scripting please check on the following file from the autopilot checks used for compiling ubuntu telegram version, maybe it can serve you as reference:

http://bazaar.launchpad.net/~cellsoftware/telegram-app/autopilotTest-3/v...

Regards.

ferlanero's picture

Great! It even support autocompletion. I'm figuring using several scripts to automate alerts and messages. Thanks!

pamoedo's picture

Thanks for your comment, much appreciated.

Regarding autocompletion and features, all the kudos goes to the original developer (https://github.com/vysheng/tg), I've just changed a couple of things in the source code to avoid the app crashing in Sailfish.

Regarding automation, this telegram-cli also support lua and json along with already added libconfig & python (already present in SailfishOS), please tell me if you need those extra capabilities and I will try to compile a new version with those optional libraries to give you as much scripting options as possible. For the moment I've added the bare minimum to make it run.

NOTE for the privileged owners of a Jolla Tablet: I will also try to compile this for i486 ASAP (if all 32bit dependencies allow me) (no luck for the moment)