From f657368ee29bdb8bab473e3cbedf936daec89cdd Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 6 Mar 2022 15:47:41 +0100 Subject: [PATCH] Add joke API that is actually funny --- http.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http.js b/http.js index 36f2555..4572419 100644 --- a/http.js +++ b/http.js @@ -58,7 +58,7 @@ module.exports = { .then(data => msg.channel.send(`<@!${target}> ${data}`)) } }, - joke: { + chucknorris: { func: (msg, [first, last]) => { if (!first) { first = "Chuck" @@ -72,6 +72,11 @@ module.exports = { .then(data => msg.reply(data.value.joke.replace(/"/g, "\"").replace(/ /g, " "))) } }, + joke: { + func: msg => fetch("https://v2.jokeapi.dev/joke/Any") + .then(res => res.json()) + .then(data => msg.reply(data.type == "single" ? data.joke : data.setup + "\n" + "||" + data.delivery + "||")) + }, "8ball": { func: msg => fetch("https://8ball.delegator.com/magic/JSON/whatever") .then(res => res.json()) -- 2.44.0