how to make aiogram.Message from telethon.Message

11 Views Asked by At

it is telethon.types.Message.to_json():

data = {"_": "Message", "id": 224551, "peer_id": {"_": "PeerUser", "user_id": 5173569442}, "date": "2024-03-25T06:40:23+00:00", "message": "", "out": true, "mentioned": false, "media_unread": false, "silent": false, "post": false, "from_scheduled": false, "legacy": false, "edit_hide": false, "pinned": false, "noforwards": false, "invert_media": false, "from_id": {"_": "PeerUser", "user_id": 741474395}, "saved_peer_id": null, "fwd_from": null, "via_bot_id": null, "reply_to": null, "media": {"_": "MessageMediaPhoto", "spoiler": false, "photo": {"_": "Photo", "id": 5190701357605181619, "access_hash": -4837791035051506518, "file_reference": "AwADbSdmARxXiEA3WcFOqo226+7Y6xM0Qg==", "date": "2024-03-25T06:40:23+00:00", "sizes": [{"_": "PhotoStrippedSize", "type": "i", "bytes": "AR4oyqKKKACiiigAooooAKKKKACiiigAooooAw=="}, {"_": "PhotoSize", "type": "m", "w": 114, "h": 85, "size": 359}], "dc_id": 2, "has_stickers": false, "video_sizes": []}, "ttl_seconds": null}, "reply_markup": 
null, "entities": [], "views": null, "forwards": null, "replies": null, "edit_date": null, "post_author": null, "grouped_id": 13690790588109674, "reactions": null, "restriction_reason": [], "ttl_period": null}

it is aiogram.types.Message.to_python():

{'message_id': 13138, 'from': {'id': 741474395, 'is_bot': False, 'first_name': 'slava', 'username': 'creehk24', 'language_code': 'ru'}, 'chat': {'id': 741474395, 'first_name': 'slava', 'username': 'creehk24', 'type': 'private'}, 'date': 1711366991, 'media_group_id': '13690791930771402', 'photo': [{'file_id': 'AgACAgIAAxkBAAIzUmYBHP_Fv_EtsxX5aDPNATQ0jS8wAAKz2DEbYhMJSNvdnTcsruRCAQADAgADcwADNAQ', 'file_unique_id': 'AQADs9gxG2ITCUh4', 'file_size': 330, 'width': 90, 'height': 67}, {'file_id': 'AgACAgIAAxkBAAIzUmYBHP_Fv_EtsxX5aDPNATQ0jS8wAAKz2DEbYhMJSNvdnTcsruRCAQADAgADbQADNAQ', 'file_unique_id': 'AQADs9gxG2ITCUhy', 'file_size': 359, 'width': 114, 'height': 85}]}

is it possible to somehow automatically create an aiogram.Message object using json?

aiogram.types.Message.to_object(data, conf=???)
0

There are 0 best solutions below