normalized ani names to remove diacritics

master
Kit Kasune 3 years ago
parent ff4fd60c35
commit 0b1f91903b
  1. 6
      util/cache/anime.js
  2. 6
      util/cache/char.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.`)}`});

@ -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;

Loading…
Cancel
Save