something-random-on-discord
Version:
A very easy to use package which gives you random things.
17 lines (13 loc) • 488 B
JavaScript
const axios = require("axios")
const userAgents = require("../../tools/user-agents.json")
const getAdvice = async () => {
let json = await axios("https://api.adviceslip.com/advice", {
headers: {
"User-Agent": userAgents[Math.floor(Math.random() * userAgents.length)]
}
});
json = json.data;
if (!json) throw "Error 01: Unable to access the json content of API"
return { embed: { description: json.slip.advice, color: "RANDOM" } };
}
module.exports = getAdvice;