Skip to content

Commit 0b12263

Browse files
authored
fix(GuildEmojiManager)!: Allow CreateGuildExpressions for retrieving author data (#11283)
* fix(GuildEmojiManager): allow `CreateGuildExpressions` * fix!: update error code BREAKING CHANGE: `MissingManageGuildExpressionsPermission` has become `MissingGuildExpressionsPermission`.
1 parent 456a6f4 commit 0b12263

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/discord.js/src/errors/ErrorCodes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
*
8484
* @property {'EmojiType'} EmojiType
8585
* @property {'EmojiManaged'} EmojiManaged
86-
* @property {'MissingManageGuildExpressionsPermission'} MissingManageGuildExpressionsPermission
86+
* @property {'MissingGuildExpressionsPermission'} MissingGuildExpressionsPermission
8787
*
8888
* @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
8989
* @property {'NotGuildSticker'} NotGuildSticker
@@ -217,7 +217,7 @@ const keys = [
217217

218218
'EmojiType',
219219
'EmojiManaged',
220-
'MissingManageGuildExpressionsPermission',
220+
'MissingGuildExpressionsPermission',
221221

222222
'NotGuildSoundboardSound',
223223
'NotGuildSticker',

packages/discord.js/src/errors/Messages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ const Messages = {
8888

8989
[ErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
9090
[ErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
91-
[ErrorCodes.MissingManageGuildExpressionsPermission]: guild =>
92-
`Client must have Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
91+
[ErrorCodes.MissingGuildExpressionsPermission]: guild =>
92+
`Client must have Create Guild Expressions or Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
9393

9494
[ErrorCodes.NotGuildSoundboardSound]: action =>
9595
`Soundboard sound is a default (non-guild) soundboard sound and can't be ${action}.`,

packages/discord.js/src/managers/GuildEmojiManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ class GuildEmojiManager extends CachedManager {
251251

252252
const { me } = this.guild.members;
253253
if (!me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
254-
if (!me.permissions.has(PermissionFlagsBits.ManageGuildExpressions)) {
255-
throw new DiscordjsError(ErrorCodes.MissingManageGuildExpressionsPermission, this.guild);
254+
if (!me.permissions.any(PermissionFlagsBits.CreateGuildExpressions | PermissionFlagsBits.ManageGuildExpressions)) {
255+
throw new DiscordjsError(ErrorCodes.MissingGuildExpressionsPermission, this.guild);
256256
}
257257

258258
const data = await this.client.rest.get(Routes.guildEmoji(this.guild.id, resolvedEmoji.id));

packages/discord.js/typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4051,7 +4051,7 @@ export enum DiscordjsErrorCodes {
40514051

40524052
EmojiType = 'EmojiType',
40534053
EmojiManaged = 'EmojiManaged',
4054-
MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
4054+
MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
40554055

40564056
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
40574057
NotGuildSticker = 'NotGuildSticker',

0 commit comments

Comments
 (0)