Merk
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
and solved, ty fella
10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
const guild = interaction.guild;
const member = await guild.members.fetch(topTres[i].userId);
member.setNickname(
${user.username}👑
)10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
i added
10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
so, inside the for(let...) i have to add members.setNickname(…) ?
10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
change the name in the guild
10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
this is my code
10 replies
DIAdiscord.js - Imagine an app
•Created by Merk on 2/6/2024 in #djs-questions
embed table whit top 3 members and change their nicknames
const {SlashCommandBuilder, GuildMember} = require("discord.js");
const {EmbedBuilder} = require("@discordjs/builders")
const profileModel = require("../models/profileSchema")
module.exports = {
data: new SlashCommandBuilder()
.setName("leaderboard")
.setDescription("Top 3"),
async execute(interaction, profileData){
await interaction.deferReply();
let leaderboardEmbed = new EmbedBuilder() .setTitle("Top 3 members") .setColor(0xEFFF00) const members = await profileModel .find() .sort({actividad: -1}) .catch((err)=>console.log(err))
const topTres = members.slice(0, 3); let desc = ""; for(let i = 0; i<topTres.length; i++){ let {user} = await interaction.guild.members.fetch(topTres[i].userId); if(!user)return; let userBalance = topTres[i].actividad; let crownEmoji = "👑"; desc +=
let leaderboardEmbed = new EmbedBuilder() .setTitle("Top 3 members") .setColor(0xEFFF00) const members = await profileModel .find() .sort({actividad: -1}) .catch((err)=>console.log(err))
const topTres = members.slice(0, 3); let desc = ""; for(let i = 0; i<topTres.length; i++){ let {user} = await interaction.guild.members.fetch(topTres[i].userId); if(!user)return; let userBalance = topTres[i].actividad; let crownEmoji = "👑"; desc +=
**${crownEmoji} ${user.username}:** ${userBalance} Messages\n
;
}
if(desc !== ""){
leaderboardEmbed.setDescription(desc);
}
await interaction.editReply({embeds: [leaderboardEmbed]})
}
}10 replies