From 14d2f9ff080e4df77026a1ea70976ab87c79a1c0 Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Fri, 2 Jul 2021 17:10:57 +0300 Subject: [PATCH] feat(client): inputPhoto getter for Photo --- packages/client/src/types/media/photo.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/client/src/types/media/photo.ts b/packages/client/src/types/media/photo.ts index a1745fd0..912418ce 100644 --- a/packages/client/src/types/media/photo.ts +++ b/packages/client/src/types/media/photo.ts @@ -156,6 +156,18 @@ export class Photo extends FileLocation { return this._uniqueFileId } + /** + * Input photo generated from this object. + */ + get inputPhoto(): tl.TypeInputPhoto { + return { + _: 'inputPhoto', + id: this.raw.id, + accessHash: this.raw.accessHash, + fileReference: this.raw.fileReference, + } + } + /** * Input media generated from this object, * to be used in {@link InputMediaLike} and @@ -164,12 +176,7 @@ export class Photo extends FileLocation { get inputMedia(): tl.TypeInputMedia { return { _: 'inputMediaPhoto', - id: { - _: 'inputPhoto', - id: this.raw.id, - accessHash: this.raw.accessHash, - fileReference: this.raw.fileReference, - }, + id: this.inputPhoto } } }