【发布时间】:2020-05-07 10:29:07
【问题描述】:
我运行这个测试代码:
import telethon.sync
from telethon import TelegramClient
from telethon.tl.functions.messages import AddChatUserRequest
from telethon.tl.functions.contacts import ImportContactsRequest
api_id = XXXXXXX
api_hash = 'XXXXXXXXXXXXXXC'
with TelegramClient('anon', api_id, api_hash) as client:
async def main():
client(AddChatUserRequest(-XXXXXXXXXXXXXX, ['username'], fwd_limit=10))
main()
它给了我这个:
/data/data/ru.iiec.pydroid3/files/temp_iiec_codefile.py:19: RuntimeWarning: coroutine 'main' was never awaited
main()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
我应该怎么做才能使程序正常运行?
【问题讨论】:
标签: python async-await python-asyncio telethon