fix(client): improved inspection

This commit is contained in:
teidesu 2021-06-27 00:27:39 +03:00
parent 274a05dc9e
commit 58f73b6709
7 changed files with 16 additions and 8 deletions

View file

@ -48,4 +48,4 @@ export class Audio extends RawDocument {
}
}
makeInspectable(Audio, ['fileSize', 'dcId'], ['inputMedia'])
makeInspectable(Audio, ['fileSize', 'dcId'], ['inputMedia', 'inputDocument'])

View file

@ -171,4 +171,4 @@ export class RawDocument extends FileLocation {
*/
export class Document extends RawDocument {}
makeInspectable(Document, ['fileSize', 'dcId'], ['inputMedia'])
makeInspectable(Document, ['fileSize', 'dcId'], ['inputMedia', 'inputDocument'])

View file

@ -112,6 +112,13 @@ export class Sticker extends RawDocument {
return this.attr.stickerset._ === 'inputStickerSetID'
}
/**
* Input sticker set that it associated with this sticker, if available.
*/
get inputStickerSet(): tl.TypeInputStickerSet | null {
return this.attr.stickerset._ === 'inputStickerSetEmpty' ? null : this.attr.stickerset
}
private _maskPosition?: Sticker.MaskPosition
/**
* Position where this mask should be placed
@ -158,4 +165,4 @@ export class Sticker extends RawDocument {
}
}
makeInspectable(Sticker, ['fileSize', 'dcId'], ['inputMedia'])
makeInspectable(Sticker, ['fileSize', 'dcId'], ['inputMedia', 'inputDocument'])

View file

@ -88,4 +88,4 @@ export class Video extends RawDocument {
}
}
makeInspectable(Video, ['fileSize', 'dcId'], ['inputMedia'])
makeInspectable(Video, ['fileSize', 'dcId'], ['inputMedia', 'inputDocument'])

View file

@ -39,4 +39,4 @@ export class Voice extends RawDocument {
}
}
makeInspectable(Voice, ['fileSize', 'dcId'], ['inputMedia'])
makeInspectable(Voice, ['fileSize', 'dcId'], ['inputMedia', 'inputDocument'])

View file

@ -179,4 +179,4 @@ export class ChatPhoto {
}
}
makeInspectable(ChatPhoto)
makeInspectable(ChatPhoto, [], ['thumb'])

View file

@ -56,10 +56,11 @@ export function makeInspectable(
getters.forEach((it) => {
try {
let val = this[it]
if (
if (Buffer.isBuffer(val)) {
val = val.toString('base64')
} else if (
val &&
typeof val === 'object' &&
!Buffer.isBuffer(val) &&
typeof val.toJSON === 'function'
) {
val = val.toJSON()