-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (23 loc) · 831 Bytes
/
main.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
34
from settings import TOKEN, ADMINS
from db.main import *
from aiogram import Bot, Dispatcher, types
from aiogram.utils import executor
from aiogram.contrib.fsm_storage.memory import MemoryStorage
import handlers
from utils import *
from apscheduler.schedulers.asyncio import AsyncIOScheduler
schedule = AsyncIOScheduler()
schedule.start()
async def on_startup(_):
for ADMIN in ADMINS:
await bot.send_message(ADMIN, '_For admins_\n\nBot is started\!')
try:
connect()
except:
initialise()
handlers.schedule = schedule_notifications(schedule)
storage = MemoryStorage()
bot = Bot(token=TOKEN, parse_mode=types.ParseMode.MARKDOWN_V2)
dp = Dispatcher(bot=bot, storage=storage)
if __name__ == '__main__':
executor.start_polling(handlers.dp, skip_updates=True, on_startup=on_startup)