refactor(client): normalized boolean fields
This commit is contained in:
parent
d8cd13fd60
commit
5b3d7a3b09
6 changed files with 15 additions and 15 deletions
|
@ -20,14 +20,14 @@ export class Invoice {
|
|||
* Whether the shipping address was requested
|
||||
*/
|
||||
isShippingAddressRequested(): boolean {
|
||||
return !!this.raw.shippingAddressRequested
|
||||
return this.raw.shippingAddressRequested!
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this is an example (test) invoice
|
||||
*/
|
||||
isTest(): boolean {
|
||||
return !!this.raw.test
|
||||
return this.raw.test!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ export namespace Poll {
|
|||
|
||||
/**
|
||||
* Answer data, to be passed to
|
||||
* {@link TelegramClient.votePoll}
|
||||
* {@link TelegramClient.sendVote}
|
||||
*/
|
||||
data: Buffer
|
||||
|
||||
|
@ -115,7 +115,7 @@ export class Poll {
|
|||
* accept votes anymore
|
||||
*/
|
||||
get isClosed(): boolean {
|
||||
return !!this.raw.closed
|
||||
return this.raw.closed!
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,21 +123,21 @@ export class Poll {
|
|||
* list of voters is publicly available
|
||||
*/
|
||||
get isPublic(): boolean {
|
||||
return !!this.raw.publicVoters
|
||||
return this.raw.publicVoters!
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this is a quiz
|
||||
*/
|
||||
get isQuiz(): boolean {
|
||||
return !!this.raw.quiz
|
||||
return this.raw.quiz!
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this poll accepts multiple answers
|
||||
*/
|
||||
get isMultiple(): boolean {
|
||||
return !!this.raw.multipleChoice
|
||||
return this.raw.multipleChoice!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,7 +102,7 @@ export class Sticker extends RawDocument {
|
|||
* Whether this is a mask
|
||||
*/
|
||||
get isMask(): boolean {
|
||||
return !!this.attr.mask
|
||||
return this.attr.mask!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,14 +128,14 @@ export class Dialog {
|
|||
* Whether this dialog is pinned
|
||||
*/
|
||||
get isPinned(): boolean {
|
||||
return !!this.raw.pinned
|
||||
return this.raw.pinned!
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this chat was manually marked as unread
|
||||
*/
|
||||
get isManuallyUnread(): boolean {
|
||||
return !!this.raw.unreadMark
|
||||
return this.raw.unreadMark!
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +151,7 @@ export class Dialog {
|
|||
* Whether this dialog is muted
|
||||
*/
|
||||
get isMuted(): boolean {
|
||||
return !!this.raw.notifySettings.silent
|
||||
return this.raw.notifySettings.silent!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,7 +50,7 @@ export class DraftMessage {
|
|||
* Whether no webpage preview will be generated
|
||||
*/
|
||||
get disableWebPreview(): boolean {
|
||||
return !!this.raw.noWebpage
|
||||
return this.raw.noWebpage!
|
||||
}
|
||||
|
||||
private _entities?: MessageEntity[]
|
||||
|
|
|
@ -158,7 +158,7 @@ export class Message {
|
|||
* - Messages sent by you to other chats are outgoing (`outgoing = true`)
|
||||
* - Messages to yourself (i.e. *Saved Messages*) are incoming (`outgoing = false`)
|
||||
*/
|
||||
get outgoing(): boolean {
|
||||
get isOutgoing(): boolean {
|
||||
if (this._emptyError) throw this._emptyError
|
||||
|
||||
return this.raw.out!
|
||||
|
@ -318,10 +318,10 @@ export class Message {
|
|||
/**
|
||||
* Whether this message contains mention of the current user
|
||||
*/
|
||||
get mentioned(): boolean {
|
||||
get isMention(): boolean {
|
||||
if (this._emptyError) throw this._emptyError
|
||||
|
||||
return !!this.raw.mentioned
|
||||
return this.raw.mentioned!
|
||||
}
|
||||
|
||||
private _viaBot: User | null
|
||||
|
|
Loading…
Reference in a new issue