Skip to content

Commit

Permalink
Merge pull request #171 from shanedewael/command-docs-edits
Browse files Browse the repository at this point in the history
Add missing ack() for command()
  • Loading branch information
Shane DeWael authored Apr 30, 2019
2 parents dde0fa5 + 9f2b285 commit d3428ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/_advanced/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ async function addTimezoneContext ({ payload, context, next }) {
context.tz_offset = user.tz_offset;
}

app.command('request', addTimezoneContext, async ({ command, context }) => {
app.command('request', addTimezoneContext, async ({ command, ack, context }) => {
// Acknowledge command request
ack();
// Get local hour of request
const local_hour = (Date.UTC() + context.tz_offset).getHours();

Expand Down
5 changes: 4 additions & 1 deletion docs/_basic/listening_responding_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Similar to actions, there are two ways to respond to slash command requests. The

```javascript
// The echo command simply echoes on command
app.command('/echo', async ({ command, say }) => {
app.command('/echo', async ({ command, ack, say }) => {
// Acknowledge command request
ack();

say(`${command.text}`);
});
```

0 comments on commit d3428ae

Please sign in to comment.