From 128f3d63ea5ec3b225da8d0c7196ea4082389f9d Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Mon, 30 Dec 2024 21:08:53 -0600 Subject: return fact --- command_impls.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/command_impls.js b/command_impls.js index 33f1b6c..ee2db6d 100644 --- a/command_impls.js +++ b/command_impls.js @@ -51,8 +51,12 @@ export function catfact(state) { get("https://meowfacts.herokuapp.com/", (res) => { res.on("data", (d) => { process.stdout.write(d); + const obj = JSON.parse(d); + const fact = obj.data[0]; + return send(state, { content: fact }); }); }).on("error", (e) => { console.error(e); + return send(state, { content: "failed to request fact" }); }); } -- cgit v1.2.3