aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js5
-rw-r--r--command_impls.js5
2 files changed, 10 insertions, 0 deletions
diff --git a/app.js b/app.js
index 0e144d3..c812e83 100644
--- a/app.js
+++ b/app.js
@@ -13,6 +13,7 @@ import {
schedule_message,
catfact,
fomx,
+ factcheck,
} from "./command_impls.js";
import { MessageSchedule } from "./message-scheduler.js";
@@ -50,6 +51,10 @@ function handle_application_command(state, data, channel_id) {
case "fomx":
return fomx(state);
+ case "factcheck":
+ if (options.length >= 1) return factcheck(state, options[0].value);
+ else return factcheck(state, True);
+
default:
console.error(`unknown command: ${name}`);
return state.res.status(400).json({ error: "unknown command" });
diff --git a/command_impls.js b/command_impls.js
index a9183f3..ed088e3 100644
--- a/command_impls.js
+++ b/command_impls.js
@@ -74,3 +74,8 @@ export function fomx(state) {
return send(state, { content: "failed to get fomx" });
});
}
+
+export function factcheck(state, truth) {
+ if (truth) return send(state, { content: "true" });
+ else return send(state, { content: "false" });
+}