Skip to content

Commit

Permalink
🔧 chore(dependencies): update dependencies in pyproject.toml
Browse files Browse the repository at this point in the history
🔨 refactor(event): remove unused AnimeIDF and related code

🚀 feat(controller): add new message handlers for various commands

♻️ refactor(controller): simplify tagger function and markdown replies
  • Loading branch information
sudoskys committed Dec 25, 2024
1 parent 6c7d7fe commit b296460
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions app/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,29 +240,32 @@ async def reply_markdown(
max_word_count=1000,
)
for item in blocks:
if item.content_type == ContentTypes.TEXT:
await bot.send_message(
chat_id=chat_id,
reply_to_message_id=reply_to_message_id,
text=item.content,
parse_mode="MarkdownV2",
)
elif item.content_type == ContentTypes.PHOTO:
await bot.send_photo(
chat_id,
(item.file_name, item.file_data),
caption=item.caption,
reply_to_message_id=reply_to_message_id,
parse_mode="MarkdownV2",
)
elif item.content_type == ContentTypes.FILE:
await bot.send_document(
chat_id,
(item.file_name, item.file_data),
caption=item.caption,
reply_to_message_id=reply_to_message_id,
parse_mode="MarkdownV2",
)
try:
if item.content_type == ContentTypes.TEXT:
await bot.send_message(
chat_id=chat_id,
reply_to_message_id=reply_to_message_id,
text=item.content,
parse_mode="MarkdownV2",
)
elif item.content_type == ContentTypes.PHOTO:
await bot.send_photo(
chat_id,
(item.file_name, item.file_data),
caption=item.caption,
reply_to_message_id=reply_to_message_id,
parse_mode="MarkdownV2",
)
elif item.content_type == ContentTypes.FILE:
await bot.send_document(
chat_id,
(item.file_name, item.file_data),
caption=item.caption,
reply_to_message_id=reply_to_message_id,
parse_mode="MarkdownV2",
)
except Exception as e:
logger.exception(e)

@bot.message_handler(
content_types=["photo", "document"], chat_types=["private"]
Expand Down

0 comments on commit b296460

Please sign in to comment.