-
Notifications
You must be signed in to change notification settings - Fork 119
Media Type Attribute Error in Message Manager #446
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The message manager encounters an AttributeError when trying to access the type attribute of the media field in NewMessage. This error occurs because the media field is sometimes being set as a string instead of the expected MediaAttachment type. The issue became apparent after the recent commit (5552ee2) that added voice message handling checks.
logs:
File "/usr/local/lib/python3.11/site-packages/aiogram_dialog/dialog.py", line 155, in callbackhandler
await dialog_manager.show()
File "/usr/local/lib/python3.11/site-packages/aiogram_dialog/manager/manager.py", line 372, in show
sent_message = await self.message_manager.show_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiogram_dialog/manager/message_manager.py", line 198, in show_message
if not self._can_edit(new_message, old_message):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiogram_dialog/manager/message_manager.py", line 154, in canedit
if self.had_voice(old_message) or self.need_voice(new_message):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiogram_dialog/manager/message_manager.py", line 126, in need_voice
and new_message.media.type == ContentType.VOICE
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'type'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working