1.0.0 • Published 3 years ago
real-facts v1.0.0
real-facts
Real Facts by Snapple
Source
All facts are scraped from the official Snapple website.
Install
$ npm install real-facts
Usage
Check test.js for an example
const { getFact } = require("real-facts");
let fact = await getFact()
// fact = { value: '455', fact: 'Lobsters can live up to 50 years.' }
Explanation
{
value: '455', // Fact Number (ex. Fact #455)
fact: 'Lobsters can live up to 50 years.' // Fact (ex. Fact: Lobsters can live up to 50 years.)
}
Example
The following example is very oversimplied but gives a rough idea on how to implement it in your discord bot
const { getFact } = require('real-facts');
client.on(`message`, async message => {
if (message.content = '!fact') {
let fact = await getFact();
message.channel.send('Fact #' + fact.value + ': ' + fact.fact);
// Fact #455: Lobsters can live up to 50 years.
}
});
1.0.0
3 years ago