nidhishpackage
Version:
This is a fun package for [Discord](https://discord.com) The library is [Discord.js](https://discord.js.org)
43 lines (36 loc) • 1.1 kB
JavaScript
const fetch = require(`node-fetch`)
const {
MessageEmbed,
Message
} = require(`discord.js`)
async function generateAnimeQuote(options = {}) {
const url = await fetch('https://animechan.vercel.app/api/random').then(response => response.json())
const {
anime,
character,
quote
} = url
const Data = {
embed: {
color: options.Color || "RANDOM",
title: `Here's a random anime quote from ${anime}`,
description: `\`${quote}\` - ${character}`,
timestamp: new Date()
}
};
if (options.ResultOnly && options.ResultOnly === true) return {
Result: {
Quote: response.quote,
Anime: response.anime,
Char: response.character
}
};
return Data;
}
module.exports = generateAnimeQuote
// example output:
// {
// anime: 'Tokyo Ghoul',
// character: 'Tokyo Ghoul',
// quote: 'The bird fights it\'s way out of the egg. The egg is the world. Who would be born, must first destroy a world.'
// }