Skip to content

Commit

Permalink
fix: replace internal calls to Emoji#url (#10025)
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Dec 3, 2023
1 parent 54453b0 commit 941642a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/discord.js/src/managers/RoleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class RoleManager extends CachedManager {
color &&= resolveColor(color);
if (permissions !== undefined) permissions = new PermissionsBitField(permissions);
if (icon) {
const guildEmojiURL = this.guild.emojis.resolve(icon)?.url;
const guildEmojiURL = this.guild.emojis.resolve(icon)?.imageURL();
icon = guildEmojiURL ? await DataResolver.resolveImage(guildEmojiURL) : await DataResolver.resolveImage(icon);
if (typeof icon !== 'string') icon = undefined;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ class RoleManager extends CachedManager {

let icon = options.icon;
if (icon) {
const guildEmojiURL = this.guild.emojis.resolve(icon)?.url;
const guildEmojiURL = this.guild.emojis.resolve(icon)?.imageURL();
icon = guildEmojiURL ? await DataResolver.resolveImage(guildEmojiURL) : await DataResolver.resolveImage(icon);
if (typeof icon !== 'string') icon = undefined;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/discord.js/src/structures/Emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ class Emoji extends Base {
}

toJSON() {
return super.toJSON({
const json = super.toJSON({
guild: 'guildId',
createdTimestamp: true,
url: true,
identifier: true,
});
json.imageURL = this.imageURL();
return json;
}
}

Expand Down

0 comments on commit 941642a

Please sign in to comment.