mirror of
https://github.com/civsocit/olgram.git
synced 2023-07-22 01:29:12 +03:00
запуск в режиме отладки
This commit is contained in:
parent
f0237ecb0b
commit
5fcb5b8900
7
main.py
7
main.py
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import argparse
|
||||||
from tortoise import Tortoise
|
from tortoise import Tortoise
|
||||||
|
|
||||||
from olgram.router import dp
|
from olgram.router import dp
|
||||||
@ -43,10 +44,16 @@ def main():
|
|||||||
"""
|
"""
|
||||||
Classic polling
|
Classic polling
|
||||||
"""
|
"""
|
||||||
|
parser = argparse.ArgumentParser("Olgram server")
|
||||||
|
parser.add_argument("--noserver", help="Не запускать сервер обратной связи, только сам Olgram (режим для "
|
||||||
|
"разработки)", action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.run_until_complete(initialization())
|
loop.run_until_complete(initialization())
|
||||||
|
|
||||||
loop.create_task(dp.start_polling())
|
loop.create_task(dp.start_polling())
|
||||||
|
if not args.noserver:
|
||||||
loop.create_task(server_main().start())
|
loop.create_task(server_main().start())
|
||||||
|
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
|
Loading…
Reference in New Issue
Block a user