from telethon.sync import TelegramClient
import time
import requests
import datetime
from chats import *
from setting import *
from text import *
with TelegramClient('session_name', api_id, api_hash) as client:
async def main():
for chat in me:
try:
await client.send_message(chat, str(text), file = 'https://i.imgur.com/TRNJTid.jpg', parse_mode = 'html')
except:
pass
now = datetime.datetime.now()
print('Рассылка завершена ' + str(now))
print('')
while True:
client.loop.run_until_complete(main())
time.sleep(7200)