-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (22 loc) · 875 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (22 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from aiogram.exceptions import TelegramNetworkError
async def start_bot():
from core.bot_core import BOT
from aiogram import Dispatcher
dp = Dispatcher()
from core.routers import ROUTERS
for router in ROUTERS:
dp.include_router(router)
await BOT.delete_webhook(drop_pending_updates=True)
await dp.start_polling(BOT)
# Здесь происходит запуск бота.
if __name__ == "__main__":
import sys
import logging
import asyncio
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
try:
asyncio.run(start_bot())
except KeyboardInterrupt:
print("Завершение работы.")
except TelegramNetworkError as e:
print(f"[E] Обнаружена ошибка соединения. Работа приостановлена. Детали ошибки: {e}")