mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
consistency: getters return null instead of undefined (#2385)
This commit is contained in:
parent
a68f14500d
commit
799eea957e
5 changed files with 10 additions and 10 deletions
|
|
@ -103,11 +103,11 @@ class GroupDMChannel extends Channel {
|
|||
|
||||
/**
|
||||
* The owner of this Group DM
|
||||
* @type {User}
|
||||
* @type {?User}
|
||||
* @readonly
|
||||
*/
|
||||
get owner() {
|
||||
return this.client.users.get(this.ownerID);
|
||||
return this.client.users.get(this.ownerID) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -301,11 +301,11 @@ class Guild extends Base {
|
|||
|
||||
/**
|
||||
* The owner of the guild
|
||||
* @type {GuildMember}
|
||||
* @type {?GuildMember}
|
||||
* @readonly
|
||||
*/
|
||||
get owner() {
|
||||
return this.members.get(this.ownerID);
|
||||
return this.members.get(this.ownerID) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -411,11 +411,11 @@ class Guild extends Base {
|
|||
|
||||
/**
|
||||
* The `@everyone` role of the guild
|
||||
* @type {Role}
|
||||
* @type {?Role}
|
||||
* @readonly
|
||||
*/
|
||||
get defaultRole() {
|
||||
return this.roles.get(this.id);
|
||||
return this.roles.get(this.id) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -424,7 +424,7 @@ class Guild extends Base {
|
|||
* @readonly
|
||||
*/
|
||||
get me() {
|
||||
return this.members.get(this.client.user.id);
|
||||
return this.members.get(this.client.user.id) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class GuildChannel extends Channel {
|
|||
* @readonly
|
||||
*/
|
||||
get parent() {
|
||||
return this.guild.channels.get(this.parentID);
|
||||
return this.guild.channels.get(this.parentID) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class GuildMember extends Base {
|
|||
* @readonly
|
||||
*/
|
||||
get voiceChannel() {
|
||||
return this.guild.channels.get(this.voiceChannelID);
|
||||
return this.guild.channels.get(this.voiceChannelID) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class User extends Base {
|
|||
* @readonly
|
||||
*/
|
||||
get dmChannel() {
|
||||
return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id);
|
||||
return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue