feat: throw custom error for uncached Guild#me (#3271)

* handle cases where Guild#me is uncached

* fix id prop

* remove unnecessary checks

* space's requested changes
This commit is contained in:
izexi
2019-05-25 12:50:32 +01:00
committed by SpaceEEC
parent 34006cb51e
commit 3f1232ebf3
5 changed files with 21 additions and 13 deletions

View File

@@ -201,6 +201,7 @@ class GuildMember extends Base {
get manageable() {
if (this.user.id === this.guild.ownerID) return false;
if (this.user.id === this.client.user.id) return false;
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
return this.guild.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
}