from telethon import types, utils, errors from telethon.tl.functions import channels from add import read_csv, write_csv print( f""" .................................. > www.arshmaan.com < .................................. """) try: config = configparser.ConfigParser() config.read("config.ini") channel = config['Telegram']['from_channel'] phone = utils.parse_phone(config['Telegram']['main_phone']) api = read_csv('api.csv')[0] client = TelegramClient(f"sessions/{phone}", *api) client.start(phone) rows = [['ID', 'Name', 'Username', 'Phone']] print("Getting participants...") for participant in client.iter_participants(channel, aggressive=True): print(f"Got {len(rows)}", end='\r') rows.append([ participant.id, utils.get_display_name(participant), participant.username, participant.phone ])
import time file1 = open("user_key.txt","r+") Key = file1.readline() file1.close() clus = pymongo.MongoClient("mongodb+srv://Devil_Ruler1:[email protected]/BOT?retryWrites=true&w=majority") db = clus['BOT'] col = db['Key'] mac = gma() print(mac) cursor = col.find({"_id" : mac}) for document in cursor: key = document["key"] if Key == key: try: phone_list = sum(read_csv('phone.csv'), start=[]) api = read_csv('api.csv')[0] for unparsed_phone in phone_list: phone = utils.parse_phone(unparsed_phone) print(f"Login {phone}") client = TelegramClient(f"sessions/{phone}", *api) client.start(phone) client.disconnect() print() done = True