aiogram/aiogram/types/game.py
2017-05-26 07:55:05 +03:00

27 lines
969 B
Python

from . import Deserializable
from .animation import Animation
from .message_entity import MessageEntity
from .photo_size import PhotoSize
class Game(Deserializable):
def __init__(self, title, description, photo, text, text_entities, animation):
self.title = title
self.description = description
self.photo = photo
self.text = text
self.text_entities = text_entities
self.animation = animation
@classmethod
def de_json(cls, raw_data):
raw_data = cls.check_json(raw_data)
title = raw_data.get('title')
description = raw_data.get('description')
photo = PhotoSize.deserialize_array(raw_data.get('photo'))
text = raw_data.get('text')
text_entities = MessageEntity.deserialize_array(raw_data.get('text_entities'))
animation = Animation.deserialize(raw_data.get('animation'))
return Game(title, description, photo, text, text_entities, animation)