Skip to content
Advertisement

How to pass data in object_ptr format in python-telegram library

In python-telegram lib; I have a problem with calling methods which require data in object_ptr data type (You can read about it in tdlib documentation)

Exactly my problem is in addContact method. How should I pass data in params ?

I act like this:

result = t.call_method('addContact',params={'contact' : { 'phone_number' : 'some number' , 'first_name' : 'some name' , 'last_name' : 'some thing' , 'vcard' : '' , 'user_id' : 0 } , 'share_phone_number' : False})
result.wait()
print(result.update)

The print result is None & no contact is added.

Where is the problem?

This links may be useful:

TDLib addContact Class Reference

TDLib contact Class Reference

Advertisement

Answer

Finaly I found the solution

I should use importContacts method to add contacts by phone number and without knowing user ID.

Also, printing result.error_info will be useful

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement