From 747032b727b57cc5c2cfec9567d0292e58512f2d Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Wed, 2 Feb 2022 15:13:09 -0700 Subject: [PATCH] display favorites in anisearch --- events/ready.js | 13 ++++++------- util/anime/anisearch.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/events/ready.js b/events/ready.js index 4b1301f..c9ebabe 100644 --- a/events/ready.js +++ b/events/ready.js @@ -98,9 +98,7 @@ module.exports = async client => { setInterval(() => vcloop(client), 60000); - let botData = await BotDataSchema.findOne({finder: 'lel'}) - ? await BotDataSchema.findOne({finder: 'lel'}) - : new BotDataSchema({ + let botData = await BotDataSchema.findOne({finder: 'lel'}) || new BotDataSchema({ finder: 'lel', commands: 0, servers: 0, @@ -109,16 +107,17 @@ module.exports = async client => { lastRestart: new Date(), errors_all: 0, }); - botData.restarts = botData.restarts + 1; - botData.lastRestart = new Date(); + if (!client.misc.config.dev) { + botData.restarts = botData.restarts + 1; + botData.lastRestart = new Date(); + await botData.save(); + } console.log(`${chalk.gray('\n[INFO]')} >> ${chalk.white(`This is restart #${botData.restarts}.`)}`); let cms = new Date().getTime(); console.log(`${chalk.gray('\n[INFO]')} >> ${chalk.white(`Startup completed in ${cms - client.misc.startup.getTime() - (client.misc.forcedReady ? 5000 : 0)}ms (${cms - client.misc.startupNoConnect.getTime() - (client.misc.forcedReady ? 5000 : 0)}ms post-connect).`)}`); - await botData.save(); - client.misc.fullyReady = true; require('../console')(client); diff --git a/util/anime/anisearch.js b/util/anime/anisearch.js index cfdf602..7b41e43 100644 --- a/util/anime/anisearch.js +++ b/util/anime/anisearch.js @@ -25,7 +25,7 @@ module.exports = async (message, client, search, threshold=-10000, type='full') //.addField('Airing', `**Began:** ${an.airStartDate}\n**Ended:** ${an.isComplete ? an.airEndDate : 'This anime is still airing!'}`) .addField("Cast", `**${an.characters.length} Characters**\n${(an.characters.length > 50 ? an.characters.slice(0, 49) : an.characters).map(char => client.misc.cache.charsID.get(char)).join(', ')}${an.characters.length > 50 ? `\n**+${an.characters.length - 50} Others**` : ''}`) .addField('Other', `**Genre(s):** ${an.genres.join(", ")}\n**Stream this at:** ${an.streamAt.join(", ")}${an.altNames && an.altNames.length ? `\n\n**Other names:** ${an.altNames.map(n => `\`${n}\``).join(', ')}` : ''}`) - .addField('Love', `**Watchers**: **${an.watchers} Natsuki ${client.utils.as(an.watchers, 'user')}** ${an.watchers === 1 ? 'has' : "have"} this anime on their list of finished anime!\n\`n?watched ${an.name}\`\n**Watchlisted**: **${an.listed} Natsuki ${client.utils.as(an.listed, 'user')}** ${an.listed === 1 ? 'has' : "have"} this anime on their list of anime they want to watch!\n\`n?watchlist add ${an.name}\``) + .addField('Love', `**Watchers**: **${an.watchers} Natsuki ${client.utils.as(an.watchers, 'user')}** ${an.watchers === 1 ? 'has' : "have"} this anime on their list of finished anime!\n\`n?watched ${an.name}\`\n**Watchlisted**: **${an.listed} Natsuki ${client.utils.as(an.listed, 'user')}** ${an.listed === 1 ? 'has' : "have"} this anime on their list of anime they want to watch!\n\`n?watchlist add ${an.name}\`\n**Favorited**: **${an.liked} Natsuki ${client.utils.as(an.liked, 'user')}** ${an.liked === 1 ? 'has' : "have"} this anime favorited!\n\`n?favanime ${an.name}\``) } da.push(an.id); return {embed: rte, id: an.id};