display favorites in anisearch

master
Kit Kasune 3 years ago
parent cc04c41bf2
commit 747032b727
  1. 13
      events/ready.js
  2. 2
      util/anime/anisearch.js

@ -98,9 +98,7 @@ module.exports = async client => {
setInterval(() => vcloop(client), 60000); setInterval(() => vcloop(client), 60000);
let botData = await BotDataSchema.findOne({finder: 'lel'}) let botData = await BotDataSchema.findOne({finder: 'lel'}) || new BotDataSchema({
? await BotDataSchema.findOne({finder: 'lel'})
: new BotDataSchema({
finder: 'lel', finder: 'lel',
commands: 0, commands: 0,
servers: 0, servers: 0,
@ -109,16 +107,17 @@ module.exports = async client => {
lastRestart: new Date(), lastRestart: new Date(),
errors_all: 0, errors_all: 0,
}); });
botData.restarts = botData.restarts + 1; if (!client.misc.config.dev) {
botData.lastRestart = new Date(); 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}.`)}`); console.log(`${chalk.gray('\n[INFO]')} >> ${chalk.white(`This is restart #${botData.restarts}.`)}`);
let cms = new Date().getTime(); 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).`)}`); 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; client.misc.fullyReady = true;
require('../console')(client); require('../console')(client);

@ -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('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("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('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); da.push(an.id);
return {embed: rte, id: an.id}; return {embed: rte, id: an.id};

Loading…
Cancel
Save