cache fixes

master
Kit Kasune 3 years ago
parent 30c481fc59
commit 2452ef62d5
  1. 6
      commands/anime/anime.js
  2. 9
      commands/anime/char.js
  3. 6
      util/cache/anime.js
  4. 2
      util/cache/char.js

@ -163,7 +163,11 @@ module.exports = {
rc.on("collect", async r => {
if (r.emoji.name !== '👎') {
while (true) {options.id = require('../../util/makeid')(4); if (!await AniData.findOne({id: options.id})) {break;}}
if (!queue) {amEmbed.addField("Reviewed", `Reviewed and submitted by <@${message.author.id}>`);}
if (!queue) {
amEmbed.addField("Reviewed", `Reviewed and submitted by <@${message.author.id}>`);
client.misc.cache.anime.set(options.name, options.id);
client.misc.cache.anime.set(options.japname, options.id);
}
else {amEmbed.addField("ID", options.id);}
amEmbed.setAuthor(!queue ? "Anime Added" : "Anime Submitted", message.author.avatarURL());
client.guilds.fetch('762707532417335296').then(g => g.channels.cache.get('817466729293938698').send({embeds: [amEmbed]}));

@ -159,11 +159,13 @@ module.exports = {
let rc = am.createReactionCollector({filter: (r, u) => ['👍', '👎'].includes(r.emoji.name) && u.id === message.author.id, max: 1, time: 60000});
rc.on("collect", async r => {
if (r.emoji.name !== '👎') {
client.guilds.fetch('762707532417335296').then(g => g.channels.cache.get('817466729293938698').send({embeds: [amEmbed]}));
if (!queue) {amEmbed.addField("Reviewed", `Reviewed and submitted by <@${message.author.id}>`);}
while (true) {options.id = require('../../util/makeid')(4); if (!await Char.findOne({id: options.id})) {break;}}
if (!queue) {
amEmbed.addField("Reviewed", `Reviewed and submitted by <@${message.author.id}>`);
client.misc.cache.chars.set(options.name, options.id);
}
else {amEmbed.addField("ID", options.id);}
amEmbed.setAuthor(!queue ? "Character Added" : "Character Submitted", message.author.avatarURL());
while (true) {options.id = require('../../util/makeid')(4); if (!await Char.findOne({id: options.id})) {break;}}
if (!queue) {options.queued = false;}
await new Char(options).save();
if (aniData) {
@ -171,6 +173,7 @@ module.exports = {
aniData.markModified('characters');
aniData.save();
}
client.guilds.fetch('762707532417335296').then(g => g.channels.cache.get('817466729293938698').send({embeds: [amEmbed]}));
return message.author.send(`Your character has been ${!queue ? "added" : "submitted"}`);
} else {
return message.author.send("Oh, okay. I'll discard that then!");

@ -6,7 +6,9 @@ module.exports = async client => {
client.misc.cache.anime = new Discord.Collection();
for await (const ani of AniData.find()) {
client.misc.cache.anime.set(ani.japname, ani.id);
client.misc.cache.anime.set(ani.name, ani.id);
if (ani.queued !== true) {
client.misc.cache.anime.set(ani.japname, ani.id);
client.misc.cache.anime.set(ani.name, ani.id);
}
}
}

@ -6,6 +6,6 @@ module.exports = async client => {
client.misc.cache.chars = new Discord.Collection();
for await (const char of CharData.find()) {
client.misc.cache.chars.set(char.name, char.id);
if (char.queued !== true) {client.misc.cache.chars.set(char.name, char.id);}
}
}
Loading…
Cancel
Save