real-facts

1.0.0 • Public • Published

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.
    }
});

Package Sidebar

Install

npm i real-facts

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

2.83 kB

Total Files

4

Last publish

Collaborators

  • ninadev