Final version
This commit is contained in:
19
main.py
19
main.py
@@ -1,12 +1,19 @@
|
||||
import asyncio
|
||||
|
||||
from pyrogram import Client
|
||||
import uvloop
|
||||
|
||||
from config import APP_HASH, APP_ID
|
||||
from controllers import Telegram
|
||||
|
||||
|
||||
async def main():
|
||||
async with Client("my_account", APP_ID, APP_HASH) as app:
|
||||
await app.send_message("me", "Hello, world2!")
|
||||
def main():
|
||||
loop = asyncio.get_event_loop()
|
||||
telegram = Telegram(loop=loop)
|
||||
futures = [
|
||||
asyncio.ensure_future(telegram.create_session()),
|
||||
]
|
||||
loop.run_until_complete(asyncio.gather(*futures))
|
||||
telegram.start_session()
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user