From 772559a2f3a3aeab92b9f0420e0bc9375d779792 Mon Sep 17 00:00:00 2001 From: Matthew Stanciu Date: Tue, 17 Nov 2020 16:19:53 -0500 Subject: [PATCH] Add /countstatus command --- api/app.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/app.js b/api/app.js index a87ad02..343a139 100644 --- a/api/app.js +++ b/api/app.js @@ -201,6 +201,20 @@ app.event('message', async (body) => { } }); +app.command('/countstatus', async ({ command, ack, respond }) => { + await ack() + const { text, user_id } = command + const channel = 'CDJMS683D' + + let oldest = await fetchOldest(channel); + let latest = await fetchLatest(channel); + + await respond({ + text: `The day's current progress is *${latest - oldest}*!`, + response_type: 'ephemeral' + }) +}); + (async (req, res) => { // Start your app try {