mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23: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 {'EmojiType'} EmojiType
|
||||||
* @property {'EmojiManaged'} EmojiManaged
|
* @property {'EmojiManaged'} EmojiManaged
|
||||||
* @property {'MissingManageGuildExpressionsPermission'} MissingManageGuildExpressionsPermission
|
* @property {'MissingGuildExpressionsPermission'} MissingGuildExpressionsPermission
|
||||||
*
|
*
|
||||||
* @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
|
* @property {'NotGuildSoundboardSound'} NotGuildSoundboardSound
|
||||||
* @property {'NotGuildSticker'} NotGuildSticker
|
* @property {'NotGuildSticker'} NotGuildSticker
|
||||||
@@ -217,7 +217,7 @@ const keys = [
|
|||||||
|
|
||||||
'EmojiType',
|
'EmojiType',
|
||||||
'EmojiManaged',
|
'EmojiManaged',
|
||||||
'MissingManageGuildExpressionsPermission',
|
'MissingGuildExpressionsPermission',
|
||||||
|
|
||||||
'NotGuildSoundboardSound',
|
'NotGuildSoundboardSound',
|
||||||
'NotGuildSticker',
|
'NotGuildSticker',
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ const Messages = {
|
|||||||
|
|
||||||
[ErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
|
[ErrorCodes.EmojiType]: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
|
||||||
[ErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
|
[ErrorCodes.EmojiManaged]: 'Emoji is managed and has no Author.',
|
||||||
[ErrorCodes.MissingManageGuildExpressionsPermission]: guild =>
|
[ErrorCodes.MissingGuildExpressionsPermission]: guild =>
|
||||||
`Client must have Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
|
`Client must have Create Guild Expressions or Manage Guild Expressions permission in guild ${guild} to see emoji authors.`,
|
||||||
|
|
||||||
[ErrorCodes.NotGuildSoundboardSound]: action =>
|
[ErrorCodes.NotGuildSoundboardSound]: action =>
|
||||||
`Soundboard sound is a default (non-guild) soundboard sound and can't be ${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;
|
const { me } = this.guild.members;
|
||||||
if (!me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
if (!me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
||||||
if (!me.permissions.has(PermissionFlagsBits.ManageGuildExpressions)) {
|
if (!me.permissions.any(PermissionFlagsBits.CreateGuildExpressions | PermissionFlagsBits.ManageGuildExpressions)) {
|
||||||
throw new DiscordjsError(ErrorCodes.MissingManageGuildExpressionsPermission, this.guild);
|
throw new DiscordjsError(ErrorCodes.MissingGuildExpressionsPermission, this.guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await this.client.rest.get(Routes.guildEmoji(this.guild.id, resolvedEmoji.id));
|
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',
|
EmojiType = 'EmojiType',
|
||||||
EmojiManaged = 'EmojiManaged',
|
EmojiManaged = 'EmojiManaged',
|
||||||
MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
|
MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
|
||||||
|
|
||||||
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
|
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
|
||||||
NotGuildSticker = 'NotGuildSticker',
|
NotGuildSticker = 'NotGuildSticker',
|
||||||
|
|||||||
Reference in New Issue
Block a user