From 12a204ca38cbb36b5be3c32669589d47301b6cfa Mon Sep 17 00:00:00 2001 From: zjorge96 Date: Wed, 1 Nov 2023 15:04:02 -0700 Subject: [PATCH] fix: added semi-colons and removed slash command --- app.js | 7 ------- service/help.js | 3 +-- slash.js | 53 ------------------------------------------------- 3 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 slash.js diff --git a/app.js b/app.js index 932f47ab..7ca5ea28 100644 --- a/app.js +++ b/app.js @@ -58,14 +58,7 @@ webserver.get("/health", async (req, res) => { winston.debug("Health check passed"); }); -// var normalizedPath = require("path").join(__dirname, "features"); -// require("fs") -// .readdirSync(normalizedPath) -// .forEach(function (file) { -// require("./features/" + file)(app); -// }); require("./features")(app); -require("./slash")(app); (async () => { await app.start(3000); diff --git a/service/help.js b/service/help.js index a42aef5a..9df2a1ef 100644 --- a/service/help.js +++ b/service/help.js @@ -94,7 +94,6 @@ Upon receiving the golden fistbump, the user will receive 20 fistbumps and will `; async function respondToHelp({ message, client }) { - console.log(client) winston.info(`@gratibot help Called`, { func: "feature.help.respondToHelp", callingUser: message.user, @@ -122,7 +121,7 @@ const thunderfuryResponse = [ async function respondToEasterEgg({ message, say }) { if (message.bot_id) { - return + return; } winston.info(`Heard reference to thunderfury`, { func: "feature.help.respondToEasterEgg", diff --git a/slash.js b/slash.js deleted file mode 100644 index f697c766..00000000 --- a/slash.js +++ /dev/null @@ -1,53 +0,0 @@ -const config = require("./config"); -// const balance = require("./service/balance"); -// const deduction = require("./service/deduction"); -const help = require("./service/help"); -// const join = require("./service/join"); -// const leaderboard = require("./service/leaderboard"); -// const metrics = require("./service/metrics"); -// const recognition = require("./service/recognition"); -// const redeem = require("./service/redeem"); - -const { - // goldenRecognizeEmoji, - // maximum, - // reactionEmoji, - // recognizeEmoji, - slashCommand, -} = config; - -function parseCommand(command) { - const parsed = { - valid: false, // indicates if a command is valid - command: command.command, // holds the type of command - channel: `<@${command.channel_id}>`, // holds the channel that the command was sent in - user: `${command.user_name}`, // holds the value for the user that will be targeted - text: command.text, // holds any additional text that is sent with the command - }; - - const raw = command.text.split(" "); // raw command as an array - parsed.command = raw[0]; - - switch (raw[0]) { - case "help": - parsed.valid = true; // command is valid, but doesn't require any additional info - break; - } - - return parsed; -} - -module.exports = function (app) { - app.command(slashCommand, async ({ command, ack, respond }) => { - await ack(); - const userCommand = parseCommand(command); - console.log("USER COMMAND"); - console.log(userCommand); - - switch (userCommand.command) { - case "help": - await respond(await help.respondToHelp(userCommand, app.client)); - break; - } - }); -};