Closed PascalKraut closed 5 years ago
Not a bug in the library.
Not a bug in the library.
yeah thanks for your help...
Same problem guys please help me
Flood Error When adding members in telegram channel/group.
How to solve it flood issue
have they fixed now?
i have a new problem. ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Traceback (most recent call last):
File "D:\Downloads\Telegram Scraper + Adder\adder.py", line 49, in
smo solved?
I keep getting error even though i am typing correct code.
Traceback (most recent call last): File "C:\Users\xxx\Desktop\TG-Scraper-main\scraper.py", line 42, in client.sign_in(phone, input(gr+'[+] Enter the code: '+re)) File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\sync.py", line 39, in syncified return loop.run_until_complete(coro) File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete return future.result() File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\auth.py", line 368, in sign_in result = await self(request) File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\users.py", line 30, in call return await self._call(self._sender, request, ordered=ordered) File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\users.py", line 79, in _call result = await future telethon.errors.rpcerrorlist.SessionPasswordNeededError: Two-steps verification is enabled and a password is required (caused by SignInRequest)
Please Help Me
Locking as none of this is a bug in the library. Third party programs using the library incorrectly is not something Telethon can fix, and mass adding users is considered spam.
Have this problem and absoulety no clue after searching 1 week for a solution. Im not a professionell so maybe its a little bit hard to solve it. Your help would be so great!!! ;) I try to add Telegram Group User to another group. Scraping those names is no problem. But adding gives me this error. Thanks so much!
CODE:
from telethon.sync import TelegramClient from telethon.tl.functions.messages import GetDialogsRequest from telethon.tl.types import InputPeerEmpty, InputPeerChannel, InputPeerUser from telethon.errors.rpcerrorlist import PeerFloodError, UserPrivacyRestrictedError from telethon.tl.functions.channels import InviteToChannelRequest import sys import csv import traceback import time import random
api_id = 'xxx' api_hash = 'xxx' phone = '+xxx' client = TelegramClient(phone, api_id, api_hash)
client.connect() if not client.is_user_authorized(): client.send_code_request(phone) client.sign_in(phone, input('Enter the code: '))
users = [] with open(r"C:\Users\Administrator\Documents\Telegram scraper\members.csv", encoding='UTF-8') as f: rows = csv.reader(f,delimiter=",",lineterminator="\n") next(rows, None) for row in rows: user = {} user['username'] = row[0] user['id'] = int(row[1]) user['access_hash'] = int(row[2]) user['name'] = row[3] users.append(user)
chats = [] last_date = None chunk_size = '200' groups=[]
result = client(GetDialogsRequest( offset_date=last_date, offset_id= 0, offset_peer=InputPeerEmpty(), limit=chunk_size, hash = 0 )) chats.extend(result.chats)
for chat in chats: try: if chat.megagroup== True: groups.append(chat) except: continue
print('Choose a group to add members:') i= 0 for group in groups: print(str(i) + '- ' + group.title) i+= 1
g_index = input("Enter a Number: ") target_group=groups[int(g_index)]
target_group_entity = InputPeerChannel(target_group.id,target_group.access_hash)
mode = int(input("Enter 1 to add by username or 2 to add by ID: "))
n = 0
for user in users: n += 1 if n % 50 == 0: sleep(900) try: print ("Adding {}".format(user['id'])) if mode == 1: if user['username'] == "": continue user_to_add = client.get_input_entity(user['username']) elif mode == 2: user_to_add = InputPeerUser(user['id'], user['access_hash']) else: sys.exit("Invalid Mode Selected. Please Try Again.") client(InviteToChannelRequest(target_group_entity,[user_to_add])) print("Waiting for 60-180 Seconds...") time.sleep(random.randrange(60, 180)) except PeerFloodError: print("Getting Flood Error from telegram. Script is stopping now. Please try again after some time.") except UserPrivacyRestrictedError: print("The user's privacy settings do not allow you to do this. Skipping.") except: traceback.print_exc() print("Unexpected Error") continue