Restore post command

This commit is contained in:
2024-02-15 12:17:19 +03:00
parent 77a916dc0b
commit 63c1b58fc9
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
from aiogram.filters import Command
from aiogram.types import Message
from neuroapi import neuroapi
from .handler import MessageHandlerABC
class RestoreCommand(MessageHandlerABC):
filter = Command('restore')
async def _command(self, message: Message):
try:
command = message.text.split()
if len(command) != 2:
raise Exception('Неверное количество аргументов')
order = command[1]
await neuroapi.post.restore_post(order)
await message.answer('Пост восстановлен')
except Exception as e:
await message.answer(f'Ошибка: {e}')