From 9947602f820a41f8e41a77320c527af112d3a302 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Mon, 20 Dec 2021 14:53:07 -0700 Subject: [PATCH] list favorite characters --- commands/anime/char.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/commands/anime/char.js b/commands/anime/char.js index a086755..230897e 100644 --- a/commands/anime/char.js +++ b/commands/anime/char.js @@ -275,7 +275,19 @@ module.exports = { return message.channel.send(`I've added **${tfc.name}** to your loved/favorited character list!`); } if (['loved', 'favorites', 'favs'].includes(args[0].toLowerCase())) { - + let cf = await CF.findOne({uid: mention ? mention.id : message.author.id}); + if (!cf || !cf.loved.length) {return message.channel.send(`Looks like ${mention ? 'they' : 'you'} haven't favorited any characters!`);} + let chars = cf.loved; + chars = chars.map(tc => Array.from(client.misc.cache.chars.keys()).filter(c => client.misc.cache.chars.get(c) === tc)); + let n = mention ? message.guild ? message.mentions.members.first().displayName : message.mentions.users.first().username : message.guild ? message.member.displayName : message.author.username; + return message.channel.send({embeds: [ + new Discord.MessageEmbed() + .setAuthor(`${n}${n.endsWith('s') ? '' : "'s"} Favorited Characters`, mention ? mention.avatarURL() : message.author.avatarURL()) + .setDescription(`**${chars.length} character${chars.length === 1 ? '': 's'} favorited**\n\n${chars.join(", ")}`) + .setColor('c375f0') + .setFooter("Natsuki") + .setTimestamp() + ]}); } } }; \ No newline at end of file