Add top artists to fm command
All checks were successful
CI / CI (push) Successful in 1m23s

This commit is contained in:
SileNce5k 2025-05-12 17:52:03 +02:00
parent 9cb5ea22cb
commit 4f57499cca
Signed by: SileNce
GPG key ID: B0A142BB4291B204
2 changed files with 24 additions and 21 deletions

View file

@ -40,6 +40,12 @@ module.exports = {
case "abl":
sendText = await getTopAlbums(message.author.id, args, message.guild)
break;
case "topartists":
case "topartist":
case "ta":
case "as":
sendText = await getTopArtists(message.author.id, args, message.guild);
break;
case "cover":
sendText = await getCurrentCover(message.author.id, message.guild);
break;

View file

@ -92,27 +92,24 @@ module.exports = async function (userID, option, guild, compatibility=false) {
});
});
}
// const embed = new EmbedBuilder()
// .setAuthor({name: `Top ${duration} tracks for ${nickname}`, iconURL: user.user.avatarURL({ dynamic: true, size: 4096 })})
// .setThumbnail(tracks[0].cover)
// .setColor(15780145)
// let tracksInfo = "";
// for(let i = 0; i < tracks.length; i++){
// let pluralCharacter = tracks[i].playcount > 1 ? 's' : '';
// let track = `${i}. **${tracks[i].artist}** - ${tracks[i].song} - *${tracks[i].playcount} play${pluralCharacter}*`;
// if(i < tracks.length - 1){
// tracksInfo += `${track}\n`;
// }else{
// tracksInfo += `${track}`;
// }
// }
// embed.addFields({
// name: ` `, value: `${tracksInfo}`
// },)
// sendText.embed = embed;
// if(compatibility)
const embed = new EmbedBuilder()
.setAuthor({name: `Top ${duration} artists for ${nickname}`, iconURL: user.user.avatarURL({ dynamic: true, size: 4096 })})
.setColor(15780145)
let artistsInfo = "";
for(let i = 0; i < artists.length; i++){
let pluralCharacter = artists[i].playcount > 1 ? 's' : '';
let track = `${i}. **${artists[i].name}** - *${artists[i].playcount} play${pluralCharacter}*`;
if(i < artists.length - 1){
artistsInfo += `${track}\n`;
}else{
artistsInfo += `${track}`;
}
}
embed.setDescription(artistsInfo);
sendText.embed = embed;
if(compatibility)
return artists;
// else
// return sendText;
else
return sendText;
}