Skip to content
Merged

Dev #50

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions botspot/components/features/user_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Dict, List, Optional, Union

from aiogram import Bot, F, types
from aiogram.exceptions import TelegramBadRequest
from aiogram.fsm.context import FSMContext
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import InaccessibleMessage, InlineKeyboardButton, InlineKeyboardMarkup, Message
Expand Down Expand Up @@ -444,6 +445,12 @@ async def handle_choice_callback(callback_query: types.CallbackQuery, state: FSM
new_text = f"{callback_query.message.text}\n\nSelected: {choice}"
try:
await callback_query.message.edit_text(new_text)
except TelegramBadRequest as e:
if "message to edit not found" in e.message:
# This can happen if the message was deleted or edited by another process
logger.debug("Message was cleaned up, skipping edit")
else:
logger.warning(f"Failed to edit message after choice selection: {e}")
except Exception as e:
logger.warning(f"Failed to edit message after choice selection: {e}")

Expand Down
4 changes: 2 additions & 2 deletions botspot/components/new/queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ async def add_item(self, item: T, user_id: Optional[int] = None):

raise QueuePermissionError("user_id is required unless single_user_mode is enabled")

# Todo: do I need the mode="json" here?
doc = item.model_dump(by_alias=True, exclude_none=True)
# Use mode="json" to serialize enums and other non-BSON types correctly
doc = item.model_dump(by_alias=True, exclude_none=True, mode="json")
logger.debug(f"Item before enrichment: {doc}")

mongo_doc = self.enrich_doc(doc, user_id)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "botspot"
version = "0.10.28"
version = "0.10.30"
description = ""
readme = "README.md"
authors = [
Expand Down