tenfy
tenfy
DIAdiscord.js - Imagine an app
Created by tenfy on 6/6/2024 in #djs-questions
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.
3 replies