vysheng / tg

telegram-cli
GNU General Public License v2.0
6.44k stars 1.52k forks source link

list_secret_chats #421

Open andreashuther opened 9 years ago

andreashuther commented 9 years ago

Hi, I´m doing some stuff with the secret chat function. My goal is to distribute secret Information to mobile devices, where they get self destructed after reading. I´m working with a /usr/bin/expect script. create_secret_chat works fine for the first time. So I can send messages to !_contact_name. But I don´t know if the user maybe deleted the secret chat on the mobile device. So sometimes, I have to use !_contact_name#2 or !_contact_name#3 instead. But how to find out? I would prefer a command like "list_secret_chats" to get the correct ID. Any other ideas? Andreas

andreashuther commented 9 years ago

let me tell it in a different way: If I run the script, I don´t know if there is already a secret_chat established, or not. I don´t want to create every time a new secret_chat..

smarnv commented 8 years ago

Currently, the only way that I know of is to type chat_with_peer and use the tab-autocompletion to find your chat (maybe even chat_with_peer !_ to see only secret chats). However, as discussed in #361, while the chats themselves are persistent, their names switch to !_user_12345 (where 12345 is the user ID you can see e.g. with user_info) when you close and reopen the CLI.

I also am not aware if one can somehow get information about whether the user still uses the secret chat on their device and hasn't deleted it yet. The suffixes #1, #2, #3, etc are because you have created multiple secret chats with the same user, e.g. with different devices of theirs (but not necessarily). However, I haven't found a way to delete secret chats inside of the CLI (see #524). The only problem is that this is just a solution when you run telegram-cli manually and doesn't help you to get that information from a script.

A command to list all secret chats would indeed be useful, but what I find even more disturbing is that their history and names are not exactly persistent (see #361).