Last active
March 27, 2018 14:10
-
-
Save lukaszlenart/09dec14ca6b58b390e3e05684d9dc1ce 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
robot.respond /show survey$/i, (msg) -> | |
msg.finish() | |
loadSurveys() | |
.then (surveys) -> | |
attachments = [] | |
attachments.push | |
title: survey.fullName | |
title_link: survey.linkToResult() | |
attachments | |
.then (attachments) -> | |
response = undefined | |
if attachments.length > 0 | |
response = | |
text: "Here is a list of active surveys:" | |
attachments: attachments | |
username: robot.name | |
as_user: true | |
else | |
response = "There are not active surveys." | |
response | |
.then (response) -> | |
robot.logger.info JSON.stringify(response) | |
msg.send response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment