сам код:
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 = ""
client = TelegramClient("tg_1", api_id=api_id, api_hash=api_hash)
async def main():
async for a in range(10):
await client.send_message("me", f"{a}")
with client:
client.loop.run_until_complete(main())
В итоге выдает ошибку:
raceback (most recent call last):
File "c:\Python Scripts\РАССЫЛКА TELEGA\test_4.py", line 18, in <module>
client.loop.run_until_complete(main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "c:\Python Scripts\РАССЫЛКА TELEGA\test_4.py", line 14, in main
async for a in range(0, 10):
TypeError: 'async for' requires an object with __aiter__ method, got range