выдаёт такую ошибку после конекта
Код:
import asyncio
import datetime
from telethon import TelegramClient
from telethon import errors
from telethon import functions, types
api_id = int(input("Api id: "))
api_hash = input('Api hash: ')
client = TelegramClient('session_new',api_id, api_hash)
client.start()
print('Bot started')
async def main():
telegram_channel = input("Telegram chanel name:")
if "https://" in telegram_channel:
telegram_channel = telegram_channel.split('/')[-1]
elif '@' in telegram_channel:
telegram_channel = telegram_channel[1:]
print(telegram_channel.strip())
try:
result = await client(functions.account.ReportPeerRequest)(
peer=telegram_channel,
reason=types.InputReportReasonSpam(),
message="This user/channel promotes Russian terrorism in the time when the Kremlin invades Ukraine"
)
print(result)
except ValueError:
print("Channel not found")
except errors.UsernameInvalidError:
print("errors.UsernameInvalidError")
except errors.FloodWaitError as e:
seconds_left = e.seconds
while seconds_left > 0:
print("Flood error. Wait for ", str(datetime.timedelta(seconds=seconds_left)))
seconds_left -= 60
await asyncio.sleep(60)
await asyncio.sleep(10 + 2 * 4)
with client:
client.loop.run_until_complete(main())
Ошибка:
D:\projects\block_bot_V2\main_V2.py:27: RuntimeWarning: coroutine 'UserMethods.__call__' was never awaited
result = await client(functions.account.ReportPeerRequest)(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "D:\projects\block_bot_V2\main_V2.py", line 48, in <module>
client.loop.run_until_complete(main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "D:\projects\block_bot_V2\main_V2.py", line 27, in main
result = await client(functions.account.ReportPeerRequest)(
TypeError: 'coroutine' object is not callable