Send error( help
from telethon import TelegramClient
import time
api_id =
api_hash = ''
message = input("Введите сообщение для рассылки")
file_users = open("users.txt")
users_list = file_users.readlines()
time_pause_string = input("Введите задержку между сообщениями (сек)")
time_pause = int(time_pause_string)
client = TelegramClient('', api_id, api_hash, system_version='')
def send_message_user(client, username, message):
try:
client.connect("")
client.send_message(username, message)
print(f'Сообщение отправлено пользователю {username}')
except Exception as e:
print(f'Ошибка при отправке сообщения: {e}')
count = 0
for line in users_list:
count += 1
username ="{}".format(line.strip())
send_message_user(client, username, message)
print(f'Сообщение отправлено пользователю {username}')
time.sleep(time_pause)
with client:
client.loop.run_until_complete(send_message_user())
print("Сообщения отправлены")
I can’t figure out where the error is in passing arguments?
I’m not very good at async, but maybe that’s the problem? or were the def arguments passed incorrectly?
New contributor
AHOH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.