39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
import asyncio
|
|
|
|
from aiogram import Dispatcher, F
|
|
from aiogram.filters import Command
|
|
|
|
from app.handlers.docker_commands import get_containers, container_actions, do_container_action
|
|
from app.handlers.events import start_bot, stop_bot
|
|
from app.handlers.multiply_commands import multiply_commands, execute_commands
|
|
from app.handlers.simple import start_command
|
|
from app.handlers.single_command import execute_command
|
|
from app.settings import bot
|
|
from app.utils.statesform import ExecuteCommandsSteps
|
|
|
|
|
|
async def start():
|
|
dp = Dispatcher()
|
|
|
|
dp.startup.register(start_bot)
|
|
dp.shutdown.register(stop_bot)
|
|
|
|
dp.message.register(start_command, Command(commands="start"))
|
|
dp.message.register(execute_command, Command(commands="command"))
|
|
dp.message.register(multiply_commands, Command(commands="multiply_commands"))
|
|
dp.message.register(get_containers, Command(commands="docker_list"))
|
|
|
|
dp.callback_query.register(container_actions, F.data.startswith("container"))
|
|
dp.callback_query.register(do_container_action, F.data.startswith("action"))
|
|
|
|
dp.message.register(execute_commands, ExecuteCommandsSteps.EXECUTE)
|
|
|
|
try:
|
|
await dp.start_polling(bot)
|
|
finally:
|
|
await bot.session.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(start())
|