Skip to content

Instantly share code, notes, and snippets.

@rwisner
Created November 23, 2020 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwisner/0960d67331898adbb45d38efc88ca387 to your computer and use it in GitHub Desktop.
Save rwisner/0960d67331898adbb45d38efc88ca387 to your computer and use it in GitHub Desktop.
Store and increment a session variable
app.handle('loop_handle', (conv) => {
var response = "";
var loopCounter = conv.user.params.counter;
if (loopCounter > 0) {
loopCounter += 1;
} else {
loopCounter = 1;
}
conv.user.params.counter = loopCounter;
response += "Loop counter equals " + loopCounter + ". ";
conv.add(response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment