From 83f4181ec75c83773ae721aaca7e3780d52a8156 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 11 Jan 2023 18:03:13 +0700 Subject: [PATCH] refactor: Move `me` and add `fetchMe()` (fix) --- src/structures/GuildEmoji.js | 2 +- src/structures/GuildMember.js | 2 +- src/structures/Invite.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/GuildEmoji.js b/src/structures/GuildEmoji.js index bfdb6ef..456b893 100644 --- a/src/structures/GuildEmoji.js +++ b/src/structures/GuildEmoji.js @@ -55,7 +55,7 @@ class GuildEmoji extends BaseGuildEmoji { * @readonly */ get deletable() { - if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME'); + if (!this.guild.members.me) throw new Error('GUILD_UNCACHED_ME'); return !this.managed && this.guild.members.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS); } diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index d9cda12..6ec2b3e 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -333,7 +333,7 @@ class GuildMember extends Base { if (this.user.id === this.guild.ownerId) return false; if (this.user.id === this.client.user.id) return false; if (this.client.user.id === this.guild.ownerId) return true; - if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME'); + if (!this.guild.members.me) throw new Error('GUILD_UNCACHED_ME'); return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0; } diff --git a/src/structures/Invite.js b/src/structures/Invite.js index 1da4353..c62b4e7 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -242,7 +242,7 @@ class Invite extends Base { get deletable() { const guild = this.guild; if (!guild || !this.client.guilds.cache.has(guild.id)) return false; - if (!guild.me) throw new Error('GUILD_UNCACHED_ME'); + if (!guild.members.me) throw new Error('GUILD_UNCACHED_ME'); return ( this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false) || guild.members.me.permissions.has(Permissions.FLAGS.MANAGE_GUILD)