Lots of Stuff

This commit is contained in:
Daniel Odendahl Jr
2017-09-18 02:29:10 +00:00
parent 74593deb25
commit 12594758be
56 changed files with 246 additions and 249 deletions
+9 -8
View File
@@ -29,21 +29,22 @@ module.exports = class AnimeCommand extends Command {
.query({ 'filter[text]': query });
const body = JSON.parse(text);
if (!body.meta.count) return msg.say('Could not find any results.');
const data = body.data[0].attributes;
const embed = new MessageEmbed()
.setColor(0xF75239)
.setAuthor('Kitsu.io', 'https://i.imgur.com/VnIpwgF.png')
.setURL(`https://kitsu.io/anime/${body.data[0].attributes.slug}`)
.setThumbnail(body.data[0].attributes.posterImage ? body.data[0].attributes.posterImage.original : null)
.setTitle(body.data[0].attributes.canonicalTitle)
.setDescription(shorten(body.data[0].attributes.synopsis))
.setURL(`https://kitsu.io/anime/${data.slug}`)
.setThumbnail(data.posterImage ? data.posterImage.original : null)
.setTitle(data.canonicalTitle)
.setDescription(shorten(data.synopsis))
.addField(' Type',
`${body.data[0].attributes.showType} - ${body.data[0].attributes.status}`, true)
`${data.showType} - ${data.status}`, true)
.addField(' Episodes',
body.data[0].attributes.episodeCount || 'N/A', true)
data.episodeCount || 'N/A', true)
.addField(' Start Date',
body.data[0].attributes.startDate ? new Date(body.data[0].attributes.startDate).toDateString() : 'N/A', true)
data.startDate ? new Date(data.startDate).toDateString() : 'N/A', true)
.addField(' End Date',
body.data[0].attributes.endDate ? new Date(body.data[0].attributes.endDate).toDateString() : 'N/A', true);
data.endDate ? new Date(data.endDate).toDateString() : 'N/A', true);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);