-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (19 loc) · 753 Bytes
/
main.py
File metadata and controls
29 lines (19 loc) · 753 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
import asyncio, logging, atexit
from aiogram import Bot, Dispatcher
from aiogram.client.default import DefaultBotProperties
from config import bot_config
from database import db
import handlers
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
async def main():
logging.basicConfig(level = logging.INFO)
bot = Bot(token = bot_config.token.get_secret_value(),
default = DefaultBotProperties(protect_content = bot_config.protect_content))
dp = Dispatcher()
dp.include_routers(handlers.router)
await bot.delete_webhook(drop_pending_updates = True)
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())
db.save_database()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~