From 2ac3fb3c833404e0b16db28dadfb683b53adfaca Mon Sep 17 00:00:00 2001 From: ION606 Date: Wed, 18 May 2022 21:53:23 +0300 Subject: [PATCH] Started the 'msearch' command --- commands/anime/{search.js => asearch.js} | 5 +++-- commands/anime/msearch.js | 26 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) rename commands/anime/{search.js => asearch.js} (92%) create mode 100644 commands/anime/msearch.js diff --git a/commands/anime/search.js b/commands/anime/asearch.js similarity index 92% rename from commands/anime/search.js rename to commands/anime/asearch.js index 41502e6..a45ab6b 100644 --- a/commands/anime/search.js +++ b/commands/anime/asearch.js @@ -1,7 +1,7 @@ const scraper = require('mal-scraper'); module.exports = { name: 'asearch', - description: 'Selmer bot gives you either an explanation or a list of stats', + description: 'Selmer bot gives you info on an anime', async execute(message, args, Discord, Client, bot) { if (args.length < 1) { return message.reply("Please specify an anime!"); } let name = ""; @@ -34,7 +34,8 @@ module.exports = { if (data.aired) { temp += `. This anime ran for ${data.aired} for a total of ${data.episodes} episodes.`} else { temp += ` and is still airing with ${data.episodes} so far!`} - temp += ` This anime has a score of ${data.score} and is ${data.popularity} on MyAnimeList!`; + temp += ` This anime has a score of ${data.score} and is ${data.popularity} on MyAnimeList!\n`; + temp += `You can see a trailer for ${data.title} here: ${data.trailer}`; temp += `\n\n(to see a summary of the anime, use '${bot.prefix}asearch ~summary')`; message.channel.send({ embeds: [new Discord.MessageEmbed().setImage(data.picture)]}); diff --git a/commands/anime/msearch.js b/commands/anime/msearch.js new file mode 100644 index 0000000..bc03c60 --- /dev/null +++ b/commands/anime/msearch.js @@ -0,0 +1,26 @@ +const scraper = require('mal-scraper'); +const search = scraper.search; +const type = "manga"; +module.exports = { + name: 'msearch', + description: 'Selmer bot gives you info on a manga', + async execute(message, args, Discord, Client, bot) { + if (args.length < 1) { return message.reply("Please specify a manga!"); } + let name = ""; + if (args.length > 1) { + let i = 0; + while (i < args.length && args[i] != '~fancy' && args[i] != '~summary' && args[i] != '~stats') { + name += args[i] + " "; + i++; + } + } + + search.search(type, { + maxResults: 1, + term: name + }).then((data) => { + console.log(data[0]); + message.reply("This command has not been implemented yet!"); + }); + } +} \ No newline at end of file