from telethon import TelegramClient
api_id = xxx #i give my id
api_hash = xxx##i give my
client = TelegramClient(name, api_id, api_hash)
async def main():
# Now you can use all client methods listed below, like for example...
await client.send_message('me', 'Hello to myself!')
with client:
client.loop.run_until_complete(main())
Run Code Online (Sandbox Code Playgroud)
我收到错误 RuntimeError: You Must use "async with" 如果事件循环正在运行(即您位于“async def”内部)