Skip to content

Commit fb4e3c7

Browse files
authored
Merge pull request #16 from uw-asa/shadowimmage/issue10
v.2.4.0 - Add "now" command
2 parents 1dcbe61 + 81281c0 commit fb4e3c7

File tree

12 files changed

+1610
-49
lines changed

12 files changed

+1610
-49
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changes
22

3+
## Version 2.4.0
4+
5+
### Feature added: "now" command suffix
6+
7+
Users can now ask for exactly what is happening at the time of command invocation by suffixing the room number with "now". This returns one of several kinds of message: If there is one event (or multiple cross listed events) then they will be returned to the user, along with the overall day's totals. If all events are in the future/past in relation to "now", then the returned info will say how long until the next event is, or how long since the last event ended (and what those events are). Finally, if "now" is a break in between events, then the command will return both the preceding and succeeding events are and how long it will be until the next event.
8+
39
## Version 2.3.7
410

511
### Dependencies

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ From within any Slack channel where the integration has been enabled, the follow
1010

1111
- `/r25 help`
1212
- `/r25 [building code] [room number]`
13+
- `/r25 [building code] [room number] now`
1314
- `/r25 [building code] [room number] tomorrow`
1415
- `/r25 [building code] [room number] +1`
1516
- `/r25 [building code] [room number] +2`
@@ -88,6 +89,10 @@ Automated testing implemented with [Mocha](https://mochajs.org/), [Chai](http://
8889

8990
> `npm run test`
9091
92+
#### Code Coverage
93+
94+
> `npm run coverage`
95+
9196
#### Github Actions
9297

9398
Automated testing enabled on github actions. Secrets are saved on github under the repository settings and are retrieved at runtime by the test runner environment.

handler.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
/* AWS Lambda function handler.js
44
* Chase Sawyer
5-
* University of Washington, 2018
5+
* University of Washington, 2018-2020
66
*
77
* Defines two Lambda functions that make up two halves of the UW-SlackR25Bot slash command, '/r25'.
88
* The parse handler parses an incoming Slack slash command through the AWS Gateway, and processes/validates
99
* it. The parse handler ends with a confirmation to Slack that the command was received/processed, and if
1010
* the command is valid, will fire off a SNS message that will trigger the second Lambda function.
1111
* The getTimes handler is triggered by the SNS message and takes the processed JSON command and response
1212
* URL in it's event parameter. It fires off a function to the r25ws function which contacts the web service
13-
* to fulfill the command.
13+
* to fulfill the command. The results from the R25 web service are then handed to a post-processing utility
14+
* in r25wsResponseHandler.js which will look through the results and give back formatted JSON for the handler
15+
* function here to pass back to Slack via postData().
1416
*
1517
* Console is used to log data to AWS CloudWatch by default.
1618
*/
@@ -149,6 +151,7 @@ function getTimes(event, context, callback) {
149151
command.resolvedCommandText = responseText.text['ERROR-R25WS-DOWN']
150152
data = responseHandler.processEmpty(command)
151153
} else {
154+
// Here's where processor utilities get called based on the determined command
152155
if (command.resolvedCommand == 'SCHEDULE') {
153156
data = responseHandler.processSchedule(results, command)
154157
} else if (command.resolvedCommand == 'BREAKS') {

0 commit comments

Comments
 (0)