(cls, json_string)
| 1363 | """ |
| 1364 | @classmethod |
| 1365 | def de_json(cls, json_string): |
| 1366 | if json_string is None: return None |
| 1367 | obj = cls.check_json(json_string, dict_copy=False) |
| 1368 | message_id = obj['message_id'] |
| 1369 | from_user = User.de_json(obj.get('from')) |
| 1370 | date = obj['date'] |
| 1371 | chat = Chat.de_json(obj['chat']) |
| 1372 | content_type = None |
| 1373 | opts = {} |
| 1374 | if 'sender_chat' in obj: |
| 1375 | opts['sender_chat'] = Chat.de_json(obj['sender_chat']) |
| 1376 | if 'is_automatic_forward' in obj: |
| 1377 | opts['is_automatic_forward'] = obj.get('is_automatic_forward') |
| 1378 | if 'is_topic_message' in obj: |
| 1379 | opts['is_topic_message'] = obj.get('is_topic_message') |
| 1380 | if 'message_thread_id' in obj: |
| 1381 | opts['message_thread_id'] = obj.get('message_thread_id') |
| 1382 | if 'reply_to_message' in obj: |
| 1383 | opts['reply_to_message'] = Message.de_json(obj['reply_to_message']) |
| 1384 | if 'via_bot' in obj: |
| 1385 | opts['via_bot'] = User.de_json(obj['via_bot']) |
| 1386 | if 'edit_date' in obj: |
| 1387 | opts['edit_date'] = obj.get('edit_date') |
| 1388 | if 'has_protected_content' in obj: |
| 1389 | opts['has_protected_content'] = obj.get('has_protected_content') |
| 1390 | if 'media_group_id' in obj: |
| 1391 | opts['media_group_id'] = obj.get('media_group_id') |
| 1392 | if 'author_signature' in obj: |
| 1393 | opts['author_signature'] = obj.get('author_signature') |
| 1394 | if 'text' in obj: |
| 1395 | opts['text'] = obj['text'] |
| 1396 | content_type = 'text' |
| 1397 | if 'entities' in obj: |
| 1398 | opts['entities'] = Message.parse_entities(obj['entities']) |
| 1399 | if 'caption_entities' in obj: |
| 1400 | opts['caption_entities'] = Message.parse_entities(obj['caption_entities']) |
| 1401 | if 'audio' in obj: |
| 1402 | opts['audio'] = Audio.de_json(obj['audio']) |
| 1403 | content_type = 'audio' |
| 1404 | if 'document' in obj: |
| 1405 | opts['document'] = Document.de_json(obj['document']) |
| 1406 | content_type = 'document' |
| 1407 | if 'animation' in obj: |
| 1408 | # Document content type accompanies "animation", so "animation" should be checked after "document" to override it |
| 1409 | opts['animation'] = Animation.de_json(obj['animation']) |
| 1410 | content_type = 'animation' |
| 1411 | if 'game' in obj: |
| 1412 | opts['game'] = Game.de_json(obj['game']) |
| 1413 | content_type = 'game' |
| 1414 | if 'photo' in obj: |
| 1415 | opts['photo'] = Message.parse_photo(obj['photo']) |
| 1416 | content_type = 'photo' |
| 1417 | if 'sticker' in obj: |
| 1418 | opts['sticker'] = Sticker.de_json(obj['sticker']) |
| 1419 | content_type = 'sticker' |
| 1420 | if 'video' in obj: |
| 1421 | opts['video'] = Video.de_json(obj['video']) |
| 1422 | content_type = 'video' |
nothing calls this directly
no test coverage detected