Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.