From c11ecf8609bde4c45fee306b05cb09420ffb8eef Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Fri, 11 Sep 2026 21:40:09 +0200 Subject: [PATCH] refactor: check managed first, document uncached author --- packages/discord.js/src/structures/GuildEmoji.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/structures/GuildEmoji.js b/packages/discord.js/src/structures/GuildEmoji.js index 46cce24a3..65cf84278 100644 --- a/packages/discord.js/src/structures/GuildEmoji.js +++ b/packages/discord.js/src/structures/GuildEmoji.js @@ -55,13 +55,15 @@ class GuildEmoji extends BaseGuildEmoji { /** * Whether the emoji is deletable by the client user + * This may be `false` if the client user has the `CreateGuildExpressions` permission + * but the emoji's author is not cached. * * @type {boolean} * @readonly */ get deletable() { - if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe); if (this.managed) return false; + if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe); const { permissions } = this.guild.members.me; if (permissions.has(PermissionFlagsBits.ManageGuildExpressions)) return true;