]) if not channels_joined: print_output(client, status="Cannot join channels") continue me = client.get_me() main_client( contacts.ImportContactsRequest([ types.InputPhoneContact(0, phone, me.first_name or '.', me.last_name or '.') ])) if from_channel_entity.broadcast: main_client.edit_admin(from_channel, phone, is_admin=True) if to_channel_entity.broadcast: main_client.edit_admin(to_channel, phone, is_admin=True) while user_rows: row = user_rows.pop(0) user_id = int(row[0]) name = row[1] user = list( filter( lambda u: u.id == user_id, client.get_participants(from_channel,
#print(chats[-1]) for chat in chats: try: if chat.megagroup== False: groups.append(chat) #print(chat) except: continue print('Choose a channel 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: ")) i = 1 #testing numbering for user in users: if mode == 1: client.edit_admin(target_group_entity,user,is_admin=True, add_admins=True) else: sys.exit("Invalid Mode Selected. Please Try Again.") client(InviteToChannelRequest(target_group_entity,[user_to_add])) print("Waiting 10 Seconds...") time.sleep(10) #sleep 900 instead 60