-1

I wonder how I can find the id of a certain user I started a regular or secret chat with.

Example:

dialogs=client.get_dialogs()
for dialog in dialogs:
    print(dialog.peerUser_id)

What can substitute the peerUser_id? Note: I use Telethon Library

  • I’m voting to close this question because this asks us to help crack security. – Prune Jun 07 '21 at 19:56
  • @Prune that doesn't seem to be a valid close reason https://meta.stackexchange.com/questions/80495/policy-regarding-questions-related-to-unethical-or-shady-practices https://meta.stackoverflow.com/questions/262656/should-questions-about-programming-viruses-and-malware-be-allowed? – Pranav Hosangadi Jun 07 '21 at 20:14
  • @Pranav -- this discussion belongs on Meta, not here -- and using resources from the most recent overhaul. – Prune Jun 07 '21 at 20:18
  • this has nothing to do with security. telegram provides an API to do these sorts of things and it's not against their ToS. – painor Jun 07 '21 at 20:19
  • In any way, please add more context to your question (and more code, e.g. your imports). – Rafael-WO Jun 08 '21 at 07:06

2 Answers2

1

You can't. Secret chats are per device and as such, you can't get any information about It from another device. the only device that sees it is the one that started it so if you didn't start it yourself you won't be able to see it.

painor
  • 1,119
  • 1
  • 8
  • 25
  • Thank you, I mistook regular chats for "secret chats", as I've seen this term frequently I thought they refer to the same thing. But now I almost get the difference. – informatics Jun 07 '21 at 21:17
0

SOLVED.

To find out the user id from a private conversation (which is a Dialog in the example) you can use :

dialog.message.peer_id.user_id