MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / de_json

Method de_json

telebot/types.py:9454–9504  ·  view source on GitHub ↗
(cls, json_string)

Source from the content-addressed store, hash-verified

9452 """
9453 @classmethod
9454 def de_json(cls, json_string):
9455 if json_string is None: return None
9456 obj = cls.check_json(json_string)
9457 obj['origin'] = MessageOrigin.de_json(obj['origin'])
9458 if 'chat' in obj:
9459 obj['chat'] = Chat.de_json(obj['chat'])
9460 if 'link_preview_options' in obj:
9461 obj['link_preview_options'] = LinkPreviewOptions.de_json(obj['link_preview_options'])
9462 if 'animation' in obj:
9463 obj['animation'] = Animation.de_json(obj['animation'])
9464 if 'audio' in obj:
9465 obj['audio'] = Audio.de_json(obj['audio'])
9466 if 'document' in obj:
9467 obj['document'] = Document.de_json(obj['document'])
9468 if 'photo' in obj:
9469 obj['photo'] = Message.parse_photo(obj['photo'])
9470 if 'sticker' in obj:
9471 obj['sticker'] = Sticker.de_json(obj['sticker'])
9472 if 'story' in obj:
9473 obj['story'] = Story.de_json(obj['story'])
9474 if 'video' in obj:
9475 obj['video'] = Video.de_json(obj['video'])
9476 if 'video_note' in obj:
9477 obj['video_note'] = VideoNote.de_json(obj['video_note'])
9478 if 'voice' in obj:
9479 obj['voice'] = Voice.de_json(obj['voice'])
9480 if 'contact' in obj:
9481 obj['contact'] = Contact.de_json(obj['contact'])
9482 if 'dice' in obj:
9483 obj['dice'] = Dice.de_json(obj['dice'])
9484 if 'game' in obj:
9485 obj['game'] = Game.de_json(obj['game'])
9486 if 'giveaway' in obj:
9487 obj['giveaway'] = Giveaway.de_json(obj['giveaway'])
9488 if 'giveaway_winners' in obj:
9489 obj['giveaway_winners'] = GiveawayWinners.de_json(obj['giveaway_winners'])
9490 if 'invoice' in obj:
9491 obj['invoice'] = Invoice.de_json(obj['invoice'])
9492 if 'location' in obj:
9493 obj['location'] = Location.de_json(obj['location'])
9494 if 'poll' in obj:
9495 obj['poll'] = Poll.de_json(obj['poll'])
9496 if 'venue' in obj:
9497 obj['venue'] = Venue.de_json(obj['venue'])
9498 if 'paid_media' in obj:
9499 obj['paid_media'] = PaidMediaInfo.de_json(obj['paid_media'])
9500 if 'checklist' in obj:
9501 obj['checklist'] = Checklist.de_json(obj['checklist'])
9502 if 'live_photo' in obj:
9503 obj['live_photo'] = LivePhoto.de_json(obj['live_photo'])
9504 return cls(**obj)
9505
9506 def __init__(
9507 self, origin: MessageOrigin, chat: Optional[Chat]=None, message_id: Optional[int]=None,

Callers

nothing calls this directly

Calls 3

check_jsonMethod · 0.80
de_jsonMethod · 0.45
parse_photoMethod · 0.45

Tested by

no test coverage detected