Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MAC addresses in bots response #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add MAC addresses in bots response #5

wants to merge 3 commits into from

Conversation

suyashmahar
Copy link
Member

No description provided.

"fallback": "Here's a pic: #{waliUrl}"
"color": "#36a64f"
"pretext": "Here's a pic:"
"pretext": "#{resp} \n Here's a pic:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msg.send will be sent before the resp is fetched, since request.get makes an asynchronous call.
So it will send empty message to slack.

resp = body

msg.send(
"attachments": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please test the script locally once, I sense there's some indentation error.

"fallback": "Here's a pic: #{waliUrl}"
"color": "#36a64f"
"pretext": "Here's a pic:"
"pretext": "#{resp} \n Here's a pic:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the complete message to fallback too. In case the attachment message fails, slack displays the fallback text.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when it fails, will the response be null?

msg.send(
"attachments": [
robot.respond /who.*lab/i, (msg) ->
waliUrl = process.env.WAIL_PIC_URL + '?t=' + new Date().getTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct the typo, wali wail .

"attachments": [
robot.respond /who.*lab/i, (msg) ->
waliUrl = process.env.WAIL_PIC_URL + '?t=' + new Date().getTime()
wailTextUrl = process.env.WAIL_NAME_URL + '?t=' + new Date().getTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add WAIL_NAME_URL to the configuration on the top of this script.

waliUrl = process.env.WAIL_PIC_URL + '?t=' + new Date().getTime()
wailTextUrl = process.env.WAIL_NAME_URL + '?t=' + new Date().getTime()

request = require 'request'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no request package defined in dependencies in package.json. Instead you could use robot.http() to make a http call. Check here.

@aniketsingh03
Copy link
Member

should I merge this @csoni111 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants