From 2524a488ba2d4c367f594deeb0f9216e2a2b86f1 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sat, 18 Dec 2021 21:08:59 -0700 Subject: [PATCH] anime cmd improvements --- commands/anime/anime.js | 9 +++++++-- models/anime.js | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/commands/anime/anime.js b/commands/anime/anime.js index bb0c579..dbfe56e 100644 --- a/commands/anime/anime.js +++ b/commands/anime/anime.js @@ -27,7 +27,7 @@ module.exports = { options = new TagFilter([ new Tag(['ask', 'question'], 'ask', 'toggle'), new Tag(['title', 't', 'name', 'n'], 'name', 'append'), - new Tag(['japname', 'japanesename', 'jn'], 'japname', 'listAppend'), + new Tag(['japname', 'japanesename', 'jn'], 'japname', 'append'), new Tag(['description', 'desc', 'd', 'plot', 'p'], 'plot', 'append'), new Tag(['pub', 'pubs', 'publishers', 'publisher', 'pb'], 'publishers', 'listAppend'), new Tag(['stud', 's', 'studio', 'studs', 'studios'], 'studios', 'listAppend'), @@ -40,7 +40,7 @@ module.exports = { new Tag(['tags', 'ta', 'tgs', 'tg', 'tag'], 'tags', 'listAppend'), new Tag(['cs', 'characters', 'chars', 'chs'], 'characters', 'listAppend'), new Tag(['streams', 'streamat', 'sa'], 'streamAt', 'listAppend'), - new Tag(['img', 'thumb', 'thumbnail', 'image']) + new Tag(['img', 'thumb', 'thumbnail', 'image'], 'thumbnail', 'append') ]).test(args.join(' ')); if (Object.keys(options).length) { @@ -138,10 +138,12 @@ module.exports = { foptions[option] = s; } } + if (!options.characters) {options.characters = [];} let amEmbed = new Discord.MessageEmbed() .setTitle(`New Anime -> ${options.name}`) .setDescription(`${queue ? 'Requested' : 'Added'} by ${message.author.tag}`) .addField('Info', `**Name:** ${options.name}\n**Japanese Name:** ${options.japname}\n\n**Publishers:** ${foptions.publishers}\n**Studios:** ${foptions.studios}`) + .addField('Description', options.plot) .addField('Length', `**# of Seasons:** ${options.seasons}\n**# of Episodes:** ${options.episodes}`) .addField('Airing', `**Began:** ${options.airStartDate}\n**Ended:** ${options.isComplete ? options.airEndDate : 'This anime is still airing!'}`) .addField('Other', `**Genre(s):** ${foptions.genres}\n**Tags:** ${foptions.tags}\n**Characters:** ${foptions.characters}\n**Stream this at:** ${foptions.streamAt}`) @@ -158,8 +160,11 @@ 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 !== '👎') { + if (!queue) {amEmbed.addField("Reviewed", `Reviewed and submitted by <@${message.author.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]})); while (true) {options.id = require('../../util/makeid')(4); if (!await AniData.findOne({id: options.id})) {break;}} + if (!queue) {options.queued = false;} await new AniData(options).save(); return message.author.send(`Your anime has been ${!queue ? "added" : "submitted"}`); } else { diff --git a/models/anime.js b/models/anime.js index 1510669..bd580b1 100644 --- a/models/anime.js +++ b/models/anime.js @@ -21,7 +21,8 @@ const AniSchema = new mongoose.Schema({ liked: {type: Number, default: 0}, rating: {type: Number, default: 0}, lastUpdate: String, - thumbnail: String + thumbnail: String, + queued: {type: Boolean, default: true} }); module.exports = mongoose.model('anime', AniSchema); \ No newline at end of file