-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (21 loc) · 735 Bytes
/
main.py
File metadata and controls
30 lines (21 loc) · 735 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
import asyncio
import os
from aiogram import Bot, Dispatcher
from dotenv import load_dotenv
load_dotenv("envs/.main")
load_dotenv("envs/.middleware")
import middleware
from functions import register_handlers
BOT_TOKEN = os.getenv("BOT_TOKEN")
ACCESS_IDS_SEPARATOR = os.getenv("ACCESS_ID_SEPARATOR")
ACCESS_IDS = [int(ID) for ID in os.getenv("ACCESS_ID").split(ACCESS_IDS_SEPARATOR)]
async def main():
bot = Bot(token=BOT_TOKEN)
dp = Dispatcher()
dp.message.middleware(middleware.AuthMiddleware(ACCESS_IDS))
dp.callback_query.middleware(middleware.AuthMiddleware(ACCESS_IDS))
register_handlers(dp)
print("|=|\tStarting")
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())