Skip to content

Instantly share code, notes, and snippets.

@bacongravy
Created April 19, 2020 05:25
Show Gist options
  • Save bacongravy/46ef6b97b88b3bc8d0ad384cca24d65c to your computer and use it in GitHub Desktop.
Save bacongravy/46ef6b97b88b3bc8d0ad384cca24d65c to your computer and use it in GitHub Desktop.
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