UNPKG

tgsnake

Version:

Telegram MTProto framework for nodejs.

105 lines (104 loc) 4.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChatPhoto = void 0; const TL_js_1 = require("../TL.js"); const platform_node_js_1 = require("../../platform.node.js"); class ChatPhoto extends TL_js_1.TLObject { smallFileId; smallUniqueId; bigFileId; bigUniqueId; constructor({ smallFileId, smallUniqueId, bigFileId, bigUniqueId, }, client) { super(client); this.smallUniqueId = smallUniqueId; this.smallFileId = smallFileId; this.bigFileId = bigFileId; this.bigUniqueId = bigUniqueId; } static parse(client, chatPhoto, chatId, chatAccessHash) { if (!chatPhoto) return; if (chatPhoto instanceof platform_node_js_1.Raw.ChatPhoto) { chatPhoto; if (chatPhoto.photoId && chatPhoto.dcId && chatId && chatAccessHash) { let bigFileId = platform_node_js_1.FileId.encode({ version: 4, subVersion: 32, fileType: platform_node_js_1.FileType.CHAT_PHOTO, thumbnailSource: platform_node_js_1.ThumbnailSource.CHAT_PHOTO_BIG, thumbnailFileType: platform_node_js_1.FileType.CHAT_PHOTO, fileTypeUniqueId: platform_node_js_1.FileTypeUniqueId.DOCUMENT, id: chatPhoto.photoId, dcId: chatPhoto.dcId, accessHash: BigInt(0), volumeId: BigInt(0), localId: 0, chatId: chatId, chatAccessHash: chatAccessHash, }); let smallFileId = platform_node_js_1.FileId.encode({ version: 4, subVersion: 32, fileType: platform_node_js_1.FileType.CHAT_PHOTO, thumbnailSource: platform_node_js_1.ThumbnailSource.CHAT_PHOTO_SMALL, thumbnailFileType: platform_node_js_1.FileType.CHAT_PHOTO, fileTypeUniqueId: platform_node_js_1.FileTypeUniqueId.DOCUMENT, id: chatPhoto.photoId, dcId: chatPhoto.dcId, accessHash: BigInt(0), volumeId: BigInt(0), localId: 0, chatId: chatId, chatAccessHash: chatAccessHash, }); return new ChatPhoto({ smallFileId: smallFileId.fileId, smallUniqueId: smallFileId.fileUniqueId, bigFileId: bigFileId.fileId, bigUniqueId: bigFileId.fileUniqueId, }, client); } } if (chatPhoto instanceof platform_node_js_1.Raw.UserProfilePhoto) { chatPhoto; let bigFileId = platform_node_js_1.FileId.encode({ version: 4, subVersion: 32, fileType: platform_node_js_1.FileType.CHAT_PHOTO, thumbnailSource: platform_node_js_1.ThumbnailSource.CHAT_PHOTO_BIG, thumbnailFileType: platform_node_js_1.FileType.CHAT_PHOTO, fileTypeUniqueId: platform_node_js_1.FileTypeUniqueId.DOCUMENT, id: chatPhoto.photoId, dcId: chatPhoto.dcId, accessHash: BigInt(0), volumeId: BigInt(0), localId: 0, chatId, chatAccessHash, }); let smallFileId = platform_node_js_1.FileId.encode({ version: 4, subVersion: 32, fileType: platform_node_js_1.FileType.CHAT_PHOTO, thumbnailSource: platform_node_js_1.ThumbnailSource.CHAT_PHOTO_SMALL, thumbnailFileType: platform_node_js_1.FileType.CHAT_PHOTO, fileTypeUniqueId: platform_node_js_1.FileTypeUniqueId.DOCUMENT, id: chatPhoto.photoId, dcId: chatPhoto.dcId, accessHash: BigInt(0), volumeId: BigInt(0), localId: 0, chatId, chatAccessHash, }); return new ChatPhoto({ smallFileId: smallFileId.fileId, smallUniqueId: smallFileId.fileUniqueId, bigFileId: bigFileId.fileId, bigUniqueId: bigFileId.fileUniqueId, }, client); } return; } } exports.ChatPhoto = ChatPhoto;