Files
neuro-reply-bot-reworked/handlers/message_handlers/newpost_command.py
2024-02-13 16:04:47 +03:00

21 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from aiogram import types
import neuroapi.types as neuroTypes
from handlers.filters.new_post import NewPostFilter, NewSoloPostFilter
from neuroapi import neuroapi
from .handler import MessageHandlerABC
class NewPostCommand(MessageHandlerABC):
filter = NewPostFilter()
async def _command(self, message: types.Message):
created = await neuroapi.image.add(str(message.from_user.id), message.photo[-1].file_id, message.has_media_spoiler, message.message_id, message.caption if message.caption else '', message.media_group_id, message.caption_entities, message)
if created: await message.answer('Пост успешно добавлен!')
class NewPostSoloCommand(MessageHandlerABC):
filter = NewSoloPostFilter()
async def _command(self, message: types.Message):
#FIXME: Починить добавление постов с одной картинкой, выводит ошибку на /info
await neuroapi.image.add(str(message.from_user.id), message.photo[-1].file_id, message.has_media_spoiler, message.message_id, message.caption, None, message.caption_entities)
await message.answer('Пост успешно добавлен!')