mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fixed json serialization issue #1450
This commit is contained in:
parent
64d17b7edf
commit
dbdd99c1b4
2 changed files with 19 additions and 0 deletions
1
CHANGES/1450.bugfix.rst
Normal file
1
CHANGES/1450.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
fixed json serialization for Message
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
from typing import TYPE_CHECKING, Any, Optional, Union
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
|
from pydantic import field_serializer
|
||||||
|
|
||||||
from ..client.default import Default
|
from ..client.default import Default
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
|
|
@ -22,6 +24,22 @@ class LinkPreviewOptions(TelegramObject):
|
||||||
show_above_text: Optional[Union[bool, Default]] = Default("link_preview_show_above_text")
|
show_above_text: Optional[Union[bool, Default]] = Default("link_preview_show_above_text")
|
||||||
"""*Optional*. :code:`True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text"""
|
"""*Optional*. :code:`True`, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text"""
|
||||||
|
|
||||||
|
@field_serializer("is_disabled", when_used="json")
|
||||||
|
def serialize_is_disabled(self, value):
|
||||||
|
return value.__str__()
|
||||||
|
|
||||||
|
@field_serializer("prefer_small_media", when_used="json")
|
||||||
|
def serialize_prefer_small_media(self, value):
|
||||||
|
return value.__str__()
|
||||||
|
|
||||||
|
@field_serializer("prefer_large_media", when_used="json")
|
||||||
|
def serialize_prefer_large_media(self, value):
|
||||||
|
return value.__str__()
|
||||||
|
|
||||||
|
@field_serializer("show_above_text", when_used="json")
|
||||||
|
def serialize_show_above_text(self, value):
|
||||||
|
return value.__str__()
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# DO NOT EDIT MANUALLY!!!
|
# DO NOT EDIT MANUALLY!!!
|
||||||
# This section was auto-generated via `butcher`
|
# This section was auto-generated via `butcher`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue