aiogram version
3.x
Problem
In case we want to dump current event/message/etc using model_dump_json method we get something like this:
{
"update_id": 909208484,
"message": {
"message_id": 3171,
"date": "2023-08-20T18:12:29Z",
"chat": {
"id": 483808054,
"type": "private",
"username": "MrYacha",
"first_name": "Yacha"
},
"from": {
"id": 483808054,
"is_bot": false,
"first_name": "Yacha",
"username": "MrYacha",
"language_code": "de",
"is_premium": true
},
"text": "/notes",
"entities": [
{
"type": "bot_command",
"offset": 0,
"length": 6
}
]
}
}
The message.date field has its own type which is not BotAPI compatible.
Possible solution
Make aiogram types serialize to BotAPI standard.
Alternatives
No response
Code example
message.model_dump_json(exclude_none=True, by_alias=True)
Additional information
No response
aiogram version
3.x
Problem
In case we want to dump current event/message/etc using model_dump_json method we get something like this:
{ "update_id": 909208484, "message": { "message_id": 3171, "date": "2023-08-20T18:12:29Z", "chat": { "id": 483808054, "type": "private", "username": "MrYacha", "first_name": "Yacha" }, "from": { "id": 483808054, "is_bot": false, "first_name": "Yacha", "username": "MrYacha", "language_code": "de", "is_premium": true }, "text": "/notes", "entities": [ { "type": "bot_command", "offset": 0, "length": 6 } ] } }The message.date field has its own type which is not BotAPI compatible.
Possible solution
Make aiogram types serialize to BotAPI standard.
Alternatives
No response
Code example
Additional information
No response