feat(client): expose info about premium users and media

This commit is contained in:
teidesu 2022-06-20 01:51:07 +03:00
parent 2c3529870a
commit 1ac0cd8530
2 changed files with 17 additions and 0 deletions

View file

@ -437,6 +437,18 @@ export class Message {
return this._media! return this._media!
} }
/**
* Whether this is a premium media
* (e.g. >2gb file or fullscreen sticker)
*/
get isPremiumMedia(): boolean {
return (
this.raw._ === 'message' &&
this.raw.media?._ === 'messageMediaDocument' &&
this.raw.media.nopremium!
)
}
private _markup?: ReplyMarkup | null private _markup?: ReplyMarkup | null
/** /**
* Reply markup provided with this message, if any. * Reply markup provided with this message, if any.

View file

@ -105,6 +105,11 @@ export class User {
return this.raw.support! return this.raw.support!
} }
/** Whether this user has Premium subscription */
get isPremium(): boolean {
return this.raw.premium!
}
/** User's or bot's first name */ /** User's or bot's first name */
get firstName(): string { get firstName(): string {
return this.raw.firstName ?? 'Deleted Account' return this.raw.firstName ?? 'Deleted Account'