refactor: Move me
and add fetchMe()
(fix)
This commit is contained in:
parent
bacb672045
commit
83f4181ec7
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user