Delete command

This commit is contained in:
2024-02-14 22:40:25 +03:00
parent d181e5ac33
commit 0c6a2a2432
2 changed files with 23 additions and 0 deletions

View File

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