fix(core): FullChat#bio is now non-nullable

This commit is contained in:
alina 🌸 2024-12-06 04:27:31 +03:00
parent af54f6e1c3
commit 7c6ae14710
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 6 additions and 3 deletions

View file

@ -291,13 +291,14 @@ export class Chat {
/**
* Title, for supergroups, channels and groups
* (`null` for private chats)
*/
get title(): string | null {
return this.peer._ !== 'user' ? this.peer.title ?? null : null
}
/**
* Username, for private chats, bots, supergroups and channels if available
* Username, for private chats, bots, supergroups and channels (if available)
*/
get username(): string | null {
if (!('username' in this.peer)) return null
@ -320,6 +321,7 @@ export class Chat {
/**
* First name of the other party in a private chat,
* for private chats and bots
* (`null` for supergroups and channels)
*/
get firstName(): string | null {
return this.peer._ === 'user' ? this.peer.firstName ?? null : null
@ -327,6 +329,7 @@ export class Chat {
/**
* Last name of the other party in a private chat, for private chats
* (`null` for supergroups and channels)
*/
get lastName(): string | null {
return this.peer._ === 'user' ? this.peer.lastName ?? null : null

View file

@ -138,8 +138,8 @@ export class FullChat extends Chat {
* Bio of the other party in a private chat, or description of a
* group, supergroup or channel.
*/
get bio(): string | null {
return this.fullPeer?.about ?? null
get bio(): string {
return this.fullPeer.about ?? ''
}
/**