get-dadjoke

2.0.2 • Public • Published

About

Get dad joke is a simple package that returns dad jokes from icanha's dad joke api

Instalation

npm install get-dadjoke

Example

const { Client } = require('discord.js');
const client = new Client();

const { getdadjoke } = require('get-dadjoke');


client.on('ready', () => {
    console.log(`${client.user.tag} has logged in!`)
})

client.on('message', async (msg) => {
    if(msg.content === 'joke') {
    
       const joke = await getdadjoke()
       
        msg.channel.send(joke);
    }
})

client.login('toek goes here');

The function is asynchronous because we need to wait for the api to return a joke, so not using async/await will end up in an empty message!

Found a bug

Create a new issue!

Readme

Keywords

none

Package Sidebar

Install

npm i get-dadjoke

Weekly Downloads

5

Version

2.0.2

License

ISC

Unpacked Size

1.71 kB

Total Files

3

Last publish

Collaborators

  • drxckzyz-