From b6039417c812890f6e92edd581c26840ae53bb4e Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 21 Aug 2017 10:51:37 +0000 Subject: [PATCH] More Fixes --- commands/search/movie.js | 8 ++++---- commands/search/tv-show.js | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/commands/search/movie.js b/commands/search/movie.js index ebff2971..ef5c4915 100644 --- a/commands/search/movie.js +++ b/commands/search/movie.js @@ -28,7 +28,7 @@ module.exports = class MovieCommand extends Command { .get('http://api.themoviedb.org/3/search/movie') .query({ api_key: TMDB_KEY, - include_adult: msg.channel.nsfw, + include_adult: msg.channel.nsfw || false, query }); if (!search.body.results.length) return msg.say('No Results.'); @@ -40,12 +40,12 @@ module.exports = class MovieCommand extends Command { .setTitle(body.title) .setURL(`https://www.themoviedb.org/movie/${body.id}`) .setAuthor('TMDB', 'https://i.imgur.com/G9q4DF1.png') - .setDescription(body.overview.substr(0, 2048)) + .setDescription(body.overview ? body.overview.substr(0, 2048) : 'No description available.') .setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null) .addField('❯ Runtime', - `${body.runtime} mins.`, true) + body.runtime ? `${body.runtime} mins.` : 'N/A', true) .addField('❯ Release Date', - body.release_date, true) + body.release_date || 'N/A', true) .addField('❯ Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : 'N/A') .addField('❯ Production Companies', diff --git a/commands/search/tv-show.js b/commands/search/tv-show.js index adfdb626..b72b45a1 100644 --- a/commands/search/tv-show.js +++ b/commands/search/tv-show.js @@ -28,7 +28,7 @@ module.exports = class TVShowCommand extends Command { .get('http://api.themoviedb.org/3/search/tv') .query({ api_key: TMDB_KEY, - include_adult: msg.channel.nsfw, + include_adult: msg.channel.nsfw || false, query }); if (!search.body.results.length) return msg.say('No Results.'); @@ -40,16 +40,16 @@ module.exports = class TVShowCommand extends Command { .setTitle(body.name) .setURL(`https://www.themoviedb.org/tv/${body.id}`) .setAuthor('TMDB', 'https://i.imgur.com/G9q4DF1.png') - .setDescription(body.overview.substr(0, 2048)) + .setDescription(body.overview ? body.overview.substr(0, 2048) : 'No description available.') .setThumbnail(body.poster_path ? `https://image.tmdb.org/t/p/w500${body.poster_path}` : null) .addField('❯ First Air Date', - body.first_air_date, true) + body.first_air_date || 'N/A', true) .addField('❯ Last Air Date', - body.last_air_date, true) + body.last_air_date || 'N/A', true) .addField('❯ Seasons', - body.number_of_seasons, true) + body.number_of_seasons || 'N/A', true) .addField('❯ Episodes', - body.number_of_episodes, true) + body.number_of_episodes || 'N/A', true) .addField('❯ Genres', body.genres.length ? body.genres.map(genre => genre.name).join(', ') : 'N/A') .addField('❯ Production Companies',