mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(GuildEmojiManager)!: Allow CreateGuildExpressions for retrieving author data (#11283)
* fix(GuildEmojiManager): allow `CreateGuildExpressions` * fix!: update error code BREAKING CHANGE: `MissingManageGuildExpressionsPermission` has become `MissingGuildExpressionsPermission`.
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
*
|
||||
* @property {'EmojiType'} EmojiType
|
||||
* @property {'EmojiManaged'} EmojiManaged
|
||||
* @property {'MissingManageGuildExpressionsPermission'} MissingManageGuildExpressionsPermission
|
||||
* @property {'MissingGuildExpressionsPermission'} MissingGuildExpressionsPermission
|
||||
*
|
||||
* @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
|
||||
* @property {'NotGuildSticker'} NotGuildSticker
|
||||
@@ -217,7 +217,7 @@ const keys = [
|
||||
|
||||
'EmojiType',
|
||||
'EmojiManaged',
|
||||
'MissingManageGuildExpressionsPermission',
|
||||
'MissingGuildExpressionsPermission',
|
||||
|
||||
'NotGuildSoundboardSound',
|
||||
'NotGuildSticker',
|
||||
|
||||
@@ -88,8 +88,8 @@ const Messages = {
|
||||
|
||||
[ErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
|
||||
[ErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
|
||||
[ErrorCodes.MissingManageGuildExpressionsPermission]: guild =>
|
||||
`Client must have Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
|
||||
[ErrorCodes.MissingGuildExpressionsPermission]: guild =>
|
||||
`Client must have Create Guild Expressions or Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
|
||||
|
||||
[ErrorCodes.NotGuildSoundboardSound]: action =>
|
||||
`Soundboard sound is a default (non-guild) soundboard sound and can't be ${action}.`,
|
||||
|
||||
@@ -251,8 +251,8 @@ class GuildEmojiManager extends CachedManager {
|
||||
|
||||
const { me } = this.guild.members;
|
||||
if (!me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
||||
if (!me.permissions.has(PermissionFlagsBits.ManageGuildExpressions)) {
|
||||
throw new DiscordjsError(ErrorCodes.MissingManageGuildExpressionsPermission, this.guild);
|
||||
if (!me.permissions.any(PermissionFlagsBits.CreateGuildExpressions | PermissionFlagsBits.ManageGuildExpressions)) {
|
||||
throw new DiscordjsError(ErrorCodes.MissingGuildExpressionsPermission, this.guild);
|
||||
}
|
||||
|
||||
const data = await this.client.rest.get(Routes.guildEmoji(this.guild.id, resolvedEmoji.id));
|
||||
|
||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -4051,7 +4051,7 @@ export enum DiscordjsErrorCodes {
|
||||
|
||||
EmojiType = 'EmojiType',
|
||||
EmojiManaged = 'EmojiManaged',
|
||||
MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
|
||||
MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
|
||||
|
||||
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
|
||||
NotGuildSticker = 'NotGuildSticker',
|
||||
|
||||
Reference in New Issue
Block a user