From 0b1f91903bb63ae6ec96279babc46d9ac44db895 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 28 Jan 2022 11:11:51 -0700 Subject: [PATCH] normalized ani names to remove diacritics --- util/cache/anime.js | 6 +++--- util/cache/char.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/util/cache/anime.js b/util/cache/anime.js index 2efcea7..dcb8e4b 100644 --- a/util/cache/anime.js +++ b/util/cache/anime.js @@ -15,10 +15,10 @@ module.exports = async (client, spinner) => { for await (const ani of AniData.find()) { if (ani.queued !== true) { - client.misc.cache.anime.set(ani.japname, ani.id); - client.misc.cache.anime.set(ani.name, ani.id); + client.misc.cache.anime.set(ani.japname.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), ani.id); + client.misc.cache.anime.set(ani.name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), ani.id); if (ani.altNames) {ani.altNames.forEach(altName => client.misc.cache.anime.set(altName, ani.id));} - client.misc.cache.animeID.set(ani.id, ani.name); + client.misc.cache.animeID.set(ani.id, ani.name.normalize("NFD").replace(/[\u0300-\u036f]/g, "")); client.misc.cache.animeLove.set(ani.id, ani.watchers); client.misc.cache.animeNum++; spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`animes into lookup registry.`)}`}); diff --git a/util/cache/char.js b/util/cache/char.js index 4ce63ef..398a859 100644 --- a/util/cache/char.js +++ b/util/cache/char.js @@ -15,9 +15,9 @@ module.exports = async (client, spinner) => { for await (const char of CharData.find()) { if (char.queued !== true) { - client.misc.cache.chars.set(char.name, char.id); - char.nicknames.forEach(nn => client.misc.cache.chars.set(nn, char.id)); - client.misc.cache.charsID.set(char.id, char.name); + client.misc.cache.chars.set(char.name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), char.id); + char.nicknames.forEach(nn => client.misc.cache.chars.set(nn.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), char.id)); + client.misc.cache.charsID.set(char.id, char.name.normalize("NFD").replace(/[\u0300-\u036f]/g, "")); client.misc.cache.charsNum++; client.misc.cache.charsLove.set(char.id, char.loved); /*let hasNull = false;