aboutsummaryrefslogtreecommitdiff
path: root/command_impls.js
diff options
context:
space:
mode:
Diffstat (limited to 'command_impls.js')
-rw-r--r--command_impls.js4
1 files changed, 4 insertions, 0 deletions
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" });
});
}