简体   繁体   English

如何在 python-telegram 库中提供 object_ptr 数据

[英]How to give object_ptr data in python-telegram library

I have a problem with calling methods which require data in object_ptr (written in tdlib documentation)我在调用需要object_ptr中数据的方法时遇到问题(写在tdlib文档中)

Exactly I mean addContact method.确切地说,我的意思是addContact方法。 how should I give data in params ?我应该如何在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)

It prints None and does not add the contact.它打印None并且不添加联系人。

Where is the problem?问题出在哪里?

This links may be useful:此链接可能有用:

TDLib addContact Class Reference TDLib addContact Class 参考

TDLib contact Class Reference TDLib 联系人 Class 参考

Finaly I found the solution最后我找到了解决方案

I should use importContacts method to add contacts by phone number and without knowing user ID.我应该使用importContacts方法在不知道用户 ID 的情况下通过电话号码添加联系人。

Also, printing result.error_info will be useful此外,打印result.error_info将很有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM