D4v1D
DIAdiscord.js - Imagine an app
•Created by D4v1D on 6/29/2024 in #djs-questions
embedbuilder undefined?
so uhm it says that embedbuilder is not defined.
let response = '';
const embed = new EmbedBuilder()
.setColor('#AC00FF')
.setTitle('Top Nation')
let ind = 0
let da = Object.keys(bdata).map(key => {
return { id: key, ...bdata[key] };
});
da.sort((a, b) => b.power - a.power);
Promise.all(da.map(item => client.users.fetch(item.id)))
.then(users => {
if (ind <= 10) {
da.forEach((item, index) => {
ind += 1
item.username = users[index].username;
});
da.forEach((item, index) => {
response += `\n${index +1} > ${item.nation} - (${item.power - 20} - ${item.power + 20}) - (${item.cash - 20} - ${item.cash + 20}) - (${item.username})`;
});
}
embed.setDescription(response)
interaction.reply({embeds: [embed]});
})
.catch(error => {
console.error('Err:', error);
interaction.reply('Error');
});
let response = '';
const embed = new EmbedBuilder()
.setColor('#AC00FF')
.setTitle('Top Nation')
let ind = 0
let da = Object.keys(bdata).map(key => {
return { id: key, ...bdata[key] };
});
da.sort((a, b) => b.power - a.power);
Promise.all(da.map(item => client.users.fetch(item.id)))
.then(users => {
if (ind <= 10) {
da.forEach((item, index) => {
ind += 1
item.username = users[index].username;
});
da.forEach((item, index) => {
response += `\n${index +1} > ${item.nation} - (${item.power - 20} - ${item.power + 20}) - (${item.cash - 20} - ${item.cash + 20}) - (${item.username})`;
});
}
embed.setDescription(response)
interaction.reply({embeds: [embed]});
})
.catch(error => {
console.error('Err:', error);
interaction.reply('Error');
});
3 replies