Mobile instant messaging from the Pi
Sending Messages
Now you can cut right to the chase and start annoying your friends. To send a single message to one of your contacts, type the following:
> msg <username> <message>
If you're not sure about your friends' usernames, you can list them with:
> contact_list
Note that Telegram has tab completion, which means you don't have to type out a command in full. For example, to get contact_list, you type con+Tab, which gives you contact; then, typing _+Tab completes the entire command.
In the contact list, you want to look at the names in green. Spaces, periods, and other symbols in contact names are substituted with underscores ( _ ). So, if you wanted to say hello to your friend Simon Pegg, you'd type:
> msg Simon_Pegg Hello!
To start a chat, you would use:
> chat_with_user Simon_Pegg
Messaging and chatting are different. After a message, you are immediately dumped back into the command line, and the program treats the next input as a command. While chatting, on the other hand, everything you type is treated like a message and is posted to your friend. To exit chat mode, type /exit or /quit.
You can send files (plain text, images, and videos) using send_text
, send_photo
, and send_video
:
> send_<type> <username> </path/to/imagefile>
with <type>
being text
, photo
, or video
. So, to send a pic to Simon, you'd type
> send_photo Simon_Pegg /home/pi/Pictures/nick_frost.jpg
and off it would go.
Receiving Messages
Although receiving pure text messages is simple (they just pop up on the next line of the terminal), attachments are a little trickier.
To be able to download and view pictures and movies that are sent to you over the Telegram CLI client, you have to start the program with the -N
option,
$ ./telegram -N
which shows an ID assigned to each message you receive.
This step is necessary because, when you are sent a message with an attachment, be it text, picture, or video, you use the message ID to save it or view it in your default viewer. An exchange could look something like this:
[23:01] User Simon Pegg is now online 379 [23:05] Simon Pegg >>> [photo] [1 unread]view_photo 379
The last line opens your default viewer and shows the photo Simon sent in the message with ID 379. To download the photo without opening it, use the load_photo
command. To download a video, you would use load_video
, and to view the video, view_video
.
Use the help
command to bring up more information about the commands you can use. Table 1 shows some of the most useful commands. To close the Telegram CLI client, type quit
at the prompt.
Table 1
Most Useful Telegram Commands
Command | Action |
---|---|
|
Tries to add a contact to the contact list by phone number. |
|
Starts chat with this user. Type /exit or /quit to end chat session. |
|
Prints information about chat. |
|
Prints info about users in your contact list. |
|
Creates secret chat with the named user. |
|
Prints info about your dialogs. |
|
Forward message to user. Start telegram with - |
|
Searches for the pattern in all messages. |
|
Prints help. |
|
Prints history (and marks it as read). Default limit = 40. |
|
Downloads photo to download directory. Start telegram with - |
|
Downloads video to download directory. Start telegram with - |
|
Mark as read all received messages from user. |
|
Sends message to user. |
|
Tries to rename contact. Can cause conflicts with your other devices. |
|
Searches for the pattern in messages from user. |
|
Sends photo to user. |
|
Sends text file as plain message. |
|
Sends video to user. |
|
Print info about potential contacts with whom you share friends. |
|
Prints info about user. |
|
Downloads photo to download directory and starts system's default viewer. Start telegram with - |
|
Downloads video to download directory and starts system's default viewer. Start telegram with - |
|
Prints encryption key. You should compare it with your partner's. |
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 4
(incl. VAT)