-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
34 lines (24 loc) · 1 KB
/
bot.py
File metadata and controls
34 lines (24 loc) · 1 KB
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 aiogram.utils import executor
from create_bot import dp
from handlers import admin, common, other
async def on_startup(_) -> None:
"""
Функция, выполняющаяся при запуске бота.
Выводит сообщение в консоль, что бот начал работу.
"""
print("Бот начал работу!")
async def on_shutdown(_) -> None:
"""
Функция, выполняющаяся при завершении работы бота.
Выводит сообщение в консоль, что бот выключен.
"""
print("Бот выключен")
# Регистрация обработчиков команд из разных модулей
admin.register_handlers_admin(dp)
common.register_handlers_common(dp)
other.register_handlers_other(dp)
if __name__ == "__main__":
# Запуск long-polling
executor.start_polling(
dp, skip_updates=True, on_startup=on_startup, on_shutdown=on_shutdown
)