tgsnake
Version:
Telegram MTProto framework for nodejs.
46 lines (45 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Game = void 0;
const platform_node_js_1 = require("../../../platform.node.js");
const TL_js_1 = require("../../TL.js");
const Animated_js_1 = require("./Animated.js");
const Photo_js_1 = require("./Photo.js");
class Game extends TL_js_1.TLObject {
id;
shortName;
title;
description;
photo;
animation;
constructor({ id, shortName, title, description, photo, animation, }, client) {
super(client);
this.id = id;
this.shortName = shortName;
this.title = title;
this.description = description;
this.photo = photo;
this.animation = animation;
}
static parse(client, game) {
let photo = undefined;
let animation = undefined;
if (game.photo && game.photo instanceof platform_node_js_1.Raw.Photo) {
photo = Photo_js_1.Photo.parse(client, game.photo);
}
if (game.document && game.document instanceof platform_node_js_1.Raw.Document) {
if (game.document.attributes.some((attribute) => attribute instanceof platform_node_js_1.Raw.DocumentAttributeAnimated)) {
animation = Animated_js_1.Animation.parse(client, game.document);
}
}
return new Game({
photo,
animation,
id: game.id,
shortName: game.shortName,
title: game.title,
description: game.description,
}, client);
}
}
exports.Game = Game;