ImportContactsRequest 方法(telethon 1.3)。通过电话号码添加新联系人不起作用。是否可以将此方法更改为另一种方法?
async def fing():
guest_phone_number = '+7XXXXXXXXX'
client = TelegramClient("sessionname",api_id = XXXXXXX, api_hash = 'XXXXXXXXXXXXXXXXXXXXXXXX').start()
client.connect()
contact = InputPhoneContact(client_id=0, phone=guest_phone_number,
first_name="custom_first_name", last_name="custom_last_name")
client(ImportContactsRequest([contact]))
getContacts = telethon.tl.functions.contacts.GetContactsRequest(0)
Contacts = client(getContacts)
print(Contacts.stringify().find('+7ХХХХХХХХХ'))
client.disconnect()
if __name__ == '__main__':
loop2 = asyncio.get_event_loop()
loop2.run_until_complete(fing())