diff --git a/commands/botinfo/info.js b/commands/botinfo/info.js index e32c1198..d7d51432 100644 --- a/commands/botinfo/info.js +++ b/commands/botinfo/info.js @@ -59,7 +59,7 @@ class InfoCommand extends commando.Command { .addField('Lib', "[discord.js](https://discord.js.org/#/) (master)", true) .addField('Packages', - "[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0), [wikifakt](https://github.com/coffee-cup/wikifakt) (1.0.3), [osu](https://github.com/IOExceptionOsu/node-osu) (1.0.1), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather) (2.2.2)") + "[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0), [wikifakt](https://github.com/coffee-cup/wikifakt) (1.0.3), [osu](https://github.com/IOExceptionOsu/node-osu) (1.0.1), [yahoo-weather](https://github.com/mamal72/node-yahoo-weather) (2.2.2), [imdb-api](https://github.com/worr/node-imdb-api) (2.2.1), [request-promise](https://github.com/request/request-promise) (4.1.1)") .addField('Other Credit', "[Cleverbot API](https://www.cleverbot.com/api/), [Wattpad API](https://developer.wattpad.com/docs/api)") .addField('My Server', diff --git a/commands/search/imdb.js b/commands/search/imdb.js new file mode 100644 index 00000000..dbb2ca02 --- /dev/null +++ b/commands/search/imdb.js @@ -0,0 +1,56 @@ +const commando = require('discord.js-commando'); +const Discord = require('discord.js'); +const imdb = require('imdb-api'); + +class IMDBCommand extends commando.Command { + constructor(Client){ + super(Client, { + name: 'imdb', + group: 'search', + memberName: 'imdb', + description: 'Searches IMDB for a specified movie. (;imdb How to Train Your Dragon)', + examples: [';imdb How to Train Your Dragon'] + }); + } + + async run(message, args) { + if(message.channel.type !== 'dm') { + if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return; + if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return; + if(!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return; + } + console.log("[Command] " + message.content); + let querymovie = message.content.split(" ").slice(1).join(" "); + let movie; + imdb.getReq({ name: querymovie }, (err, things) => { + movie = things; + if(movie === undefined) { + message.channel.sendMessage(":x: Error! Movie not found!"); + } else { + const embed = new Discord.RichEmbed() + .setColor(0xDBA628) + .setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png') + .setURL(movie.imdburl) + .setTitle(movie.title + ' (' + movie.rating + ' Score)') + .setDescription(movie.plot.substr(0, 1500) + "... [Read the Rest Here!](" + movie.imdburl + ")") + .addField('**Genres:**', + movie.genres) + .addField('**Year:**', + movie.year, true) + .addField('**Rated:**', + movie.rated, true) + .addField('**Runtime:**', + movie.runtime, true) + .addField('**Director:**', + movie.director, true) + .addField('**Writer:**', + movie.writer, true) + .addField('**Actors:**', + movie.actors, true); + message.channel.sendEmbed(embed).catch(console.error); + } + }); + } +} + +module.exports = IMDBCommand; \ No newline at end of file diff --git a/package.json b/package.json index c9181a7c..d6c31b11 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "discord.js-commando": "^0.9.0", "google-translate-api": "^2.2.2", "hepburn": "^1.0.0", + "imdb-api": "^2.2.1", "jimp": "^0.2.27", "osu": "^1.0.1", "pirate-speak": "^1.0.1",