fix(user): support deleted accounts

This commit is contained in:
teidesu 2021-04-25 13:40:04 +03:00
parent 756e43c56a
commit 960f994660

View file

@ -106,7 +106,7 @@ export class User {
/** User's or bot's first name */ /** User's or bot's first name */
get firstName(): string { get firstName(): string {
return this._user.firstName! return this._user.firstName ?? 'Deleted Account'
} }
/** User's or bot's last name */ /** User's or bot's last name */
@ -251,6 +251,7 @@ export class User {
* only first name otherwise. * only first name otherwise.
*/ */
get displayName(): string { get displayName(): string {
if (!this.firstName) return 'Deleted Account'
if (this.lastName) return `${this.firstName} ${this.lastName}` if (this.lastName) return `${this.firstName} ${this.lastName}`
return this.firstName return this.firstName
} }