Can't set role icon

Discord.js version: 14.15.3 Node version: v20.5.1
Code:
const customEmojis = content.match(/<a?:\w+:(\d+)>/g);
const attachments = message.attachments;

let response;
if (customEmojis) {
response = await axios.get(`https://cdn.discordapp.com/emojis/${customEmojis[0].match(/:(\d+)>/)[1]}.png`, { responseType: "arraybuffer" })
} else if (attachments) {
response = await axios.get(attachments.first().url, { responseType: "arraybuffer" });
}
console.log(response.data);
await discordRole.setIcon(response.data);
const customEmojis = content.match(/<a?:\w+:(\d+)>/g);
const attachments = message.attachments;

let response;
if (customEmojis) {
response = await axios.get(`https://cdn.discordapp.com/emojis/${customEmojis[0].match(/:(\d+)>/)[1]}.png`, { responseType: "arraybuffer" })
} else if (attachments) {
response = await axios.get(attachments.first().url, { responseType: "arraybuffer" });
}
console.log(response.data);
await discordRole.setIcon(response.data);
I get no errors, so i have no idea what to do. The bot has Administrator permissions.
2 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
tenfy
tenfyOP6mo ago
Solved: If unicodeEmoji isn't null you can't set the icon for role
Want results from more Discord servers?
Add your server