from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.channels.GetFullChannelRequest(
channel='username'
))
print(result.stringify())
Ошибка:
(util.py:68 WorkerThread1) ERROR - TeleBot: "RuntimeError occurred, args=("There is no current event loop in thread 'WorkerThread1'.",)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/telebot/util.py", line 62, in run
task(*args, **kwargs)
File "main.py", line 783, in callback_inline
with TelegramClient(name_telethon, api_id, api_hash) as client:
File "/usr/local/lib/python3.8/dist-packages/telethon/client/telegrambaseclient.py", line 231, in __init__
self._loop = loop or asyncio.get_event_loop()
File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'WorkerThread1'.