Write a script that adds contacts to the cart, the code works with one account but I don't want on the other; the code is simple as hell, but to understand what's not can't.
from telethon TelegramClient import, sync
from telethon.tl.functions.contacts import ImportContactsRequest
from telethon.tl.types import InputPhoneContact
from time import sleep
api_id = xxx
api_hash = 'xxx'
phone = "xxx"
client = TelegramClient('Pars-session', api_id, api_hash)
phone_numbers = open('phone-numbers.txt', 'r')
phones = open('tg-phones.txt', 'a', encoding='utf8')
x = int(1)
for phone_number in phone_numbers:
contact = InputPhoneContact(client_id=0, phone=phone_number, first_name=phone_number, last_name=phone_number)
result = client(ImportContactsRequest([contact]))
phones.write("the Number is not added:" + phone_number)
print(x, ") a Room not added: ", phone_number)
x += 1
phones.write("Room added:" + phone_number)
print(x, ") Number attached: ", phone_number)
x += 1
The only thing that is strange to me is that early result gave all the data about the user, and is not, what can I do?