Created
April 19, 2020 05:25
-
-
Save bacongravy/46ef6b97b88b3bc8d0ad384cca24d65c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stash = require("../db").namespace("stash"); | |
module.exports = app => { | |
app.command("/stash", async ({ ack, respond, command }) => { | |
await ack(); | |
const uniqueId = `${command.team_id}-${command.user_id}`; | |
if (command.text) { | |
await stash.set(uniqueId, command.text); | |
await respond("Your secret is safe with me."); | |
} else { | |
const text = (await stash.get(uniqueId)) || "I don't know your secret."; | |
await respond(text); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment