1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-26 15:45:38 -05:00

Only pick guild avatar if it exists

This commit is contained in:
AnxietyisReal 2023-06-11 15:57:51 +10:00
parent 14b13dd190
commit 5192a7c93c

View File

@ -24,7 +24,7 @@ export default {
const index = allData.sort((a, b) => b.messages - a.messages).map(x => x._id).indexOf(member.id) + 1;
const memberDifference = userData.messages - client.userLevels.algorithm(userData.level);
const levelDifference = client.userLevels.algorithm(userData.level+1) - client.userLevels.algorithm(userData.level);
interaction.reply({embeds: [new client.embed().setColor(member.displayColor).setTitle(`Level: **${userData.level}**\nRank: **${index ? '#' + index : 'last'}**\nProgress: **${memberDifference}/${levelDifference} (${(memberDifference/levelDifference*100).toFixed(2)}%)**\nTotal: **${userData.messages}**`).setThumbnail(member.user.avatarURL({ extension: 'png', size: 256}) || member.user.defaultAvatarURL)]})
interaction.reply({embeds: [new client.embed().setColor(member.displayColor).setTitle(`Level: **${userData.level}**\nRank: **${index ? '#' + index : 'last'}**\nProgress: **${memberDifference}/${levelDifference} (${(memberDifference/levelDifference*100).toFixed(2)}%)**\nTotal: **${userData.messages.toLocaleString('en-US')}**`).setThumbnail(member.avatarURL({extension:'png',size:1024}) || member.user.avatarURL({extension:'png',size:1024}) || member.user.defaultAvatarURL)]})
},
leaderboard: ()=>{
const messageCountsTotal = allData.reduce((a, b) => a + b.messages, 0);