nidhishpackage
Version:
This is a fun package for [Discord](https://discord.com) The library is [Discord.js](https://discord.js.org)
21 lines (17 loc) • 601 B
JavaScript
async function getadvice(options = {}) {
const Fetch = require(`node-fetch`)
const res = await Fetch("https://api.adviceslip.com/advice"), { slip } = await res.json();
if (!slip.advice) throw new Error(`Something Went Wrong, Try Again Later!`);
const Data = {
embed: {
color: options.Color || "RANDOM",
description: slip.advice,
timestamp: new Date()
}
};
if (options.ResultOnly && options.ResultOnly === true) return {
Result: slip.advice
};
return Data;
};
module.exports = getadvice