-
Notifications
You must be signed in to change notification settings - Fork 4
/
bot.py
33 lines (22 loc) · 2.02 KB
/
bot.py
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
32
33
from aiogram import Bot, executor
from dotenv import load_dotenv
import os
from src.utils.connect_db import con
from src.utils.db_functions import create_table_products, create_table_bank_card, create_table_carts, create_table_orders, create_table_categories
from src.loader import dp
load_dotenv()
bot = Bot(os.getenv('TOKEN'))
async def on_startup(dispatcher):
await create_table_products()
await create_table_bank_card()
await create_table_carts()
await create_table_orders()
await create_table_categories()
async def on_shutdown(dispatcher):
con.close()
if __name__ == '__main__':
from src.handlers.admins import admin_panel
from src.handlers.users import user_panel
print(" ████ \n ░░███ ░░███ \n ███████ █████ ███ █████ ██████ ████████ █████ ░███ \n░░░███░ ░░███ ░███░░███ ███░░███░░███░░███ ███░░ ░███ \n ░███ ░███ ░███ ░███ ░███████ ░███ ░░░ ░░█████ ░███ \n ░███ ███ ░░███████████ ░███░░░ ░███ ░░░░███ ░███ \n ░░█████ ░░████░████ ░░██████ ░███████ ██████ █████\n ░░░░░ ░░░░ ░░░░ ░░░░░░ ░░░░░ ░░░░░░ ░░░░░ \n \n \n \nBot started successfully")
executor.start_polling(dp, on_startup=on_startup, on_shutdown=on_shutdown)
print("Bot stopped")