This command will send a random one line joke! You can change the tags to what you want to filter the type of jokes you want!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.startsWith(`?oneline`)) {
var oneLinerJoke = require('one-liner-joke');
/*
The variable getRandomJoke will contain a random joke with a format:
{"body":"Artificial intelligence is no match for natural stupidity.","tags":["intelligence","stupid"]}
*/
var getRandomJoke = oneLinerJoke.getRandomJoke();
console.log(getRandomJoke);
/*
One can add exclusion filter for the jokes tags
default is ['racist', 'dirty', 'sex']
*/
var getRandomJoke = oneLinerJoke.getRandomJoke({
exclude_tags: ['clean', 'cars', 'nature', 'animals', 'games'],
});
var getRandomJoke = getRandomJoke.body
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `${getRandomJoke}`,
});
console.log(getRandomJoke);
}