Сам код:
from telethon.sync import TelegramClient, events, types
from telethon.tl.functions.channels import JoinChannelRequest
from telethon.tl.functions.channels import InviteToChannelRequest
import socks
from time import sleep
import os
api_id = ""
api_hash = ""
file = os.walk("C:\Python Scripts\РАССЫЛКА TELEGA")
file_2 = []
for a in file:
file_2.append(a[2])
file_3 = file_2[0]
file_4 = []
file_7 = open('username_test.txt', 'r', encoding='utf-8').read().split()
file_9 = open("spam_text.txt", "r", encoding="utf-8").readlines()
file_10 = open('proxy_list.txt', 'r', encoding='utf-8').readlines()
for b in file_3:
if b.endswith(".session"):
file_4.append(b)
input_menu = int(input('Выберите опцию:\nРассылка(1) | Инвайтинг(2):\n'))
if input_menu == 1:
# input_text = str('Введите текст:\n')
input_count_sms = int(input("Введите кол-во сообщений:\n"))
count_1 = int(len(file_4) * 30)
count_2 = 0
# print(len(file_4))
diff = int(input_count_sms / len(file_4))
diff_2 = diff + 1
file_4 = file_4 * diff
client_2 = TelegramClient("tg_1", api_id=api_id, api_hash=api_hash)
async def main_2():
for c, d, e, f in zip(file_4, file_7, file_9, file_10):
if count_2 != count_1:
g = f.split()
client = TelegramClient(f"{c}", api_id=api_id, api_hash=api_hash)
async def main():
try:
await client.send_message(d, e[:-1])
sleep(2)
except:
print(f'Пользователь с никнеймом: {d}, не найден')
file_7.pop(0)
file_8 = open("username_test.txt", "w", encoding="utf-8")
for i in file:
if i != file_7[-1]:
file_8.write(i + "\n")
else:
file_8.write(i)
count_2 = count_2 + 1
with client:
client.loop.run_until_complete(main())
else:
print("Рассылка была завершена из-за превышения лимита сообщений")
break
with client_2:
client_2.loop.run_until_complete(main_2())
if input_menu == 2:
pass
А код даже не выдает ошибку, просто завершается перед циклом for c, d, e, f in zip(file_4, file_7, file_9, file_10)