Skip to content

Add MAC addresses in bots response#5

Open
suyashmahar wants to merge 3 commits intomdgspace:masterfrom
suyashmahar:feat/presence
Open

Add MAC addresses in bots response#5
suyashmahar wants to merge 3 commits intomdgspace:masterfrom
suyashmahar:feat/presence

Conversation

@suyashmahar
Copy link
Copy Markdown
Member

No description provided.

Comment thread scripts/wail.coffee Outdated
"fallback": "Here's a pic: #{waliUrl}"
"color": "#36a64f"
"pretext": "Here's a pic:"
"pretext": "#{resp} \n Here's a pic:"
Copy link
Copy Markdown
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.

Comment thread scripts/wail.coffee Outdated
resp = body

msg.send(
"attachments": [
Copy link
Copy Markdown
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.

Comment thread scripts/wail.coffee Outdated
"fallback": "Here's a pic: #{waliUrl}"
"color": "#36a64f"
"pretext": "Here's a pic:"
"pretext": "#{resp} \n Here's a pic:"
Copy link
Copy Markdown
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
Copy Markdown
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?

Comment thread scripts/wail.coffee Outdated
msg.send(
"attachments": [
robot.respond /who.*lab/i, (msg) ->
waliUrl = process.env.WAIL_PIC_URL + '?t=' + new Date().getTime()
Copy link
Copy Markdown
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 .

Comment thread scripts/wail.coffee Outdated
"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
Copy Markdown
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.

Comment thread scripts/wail.coffee Outdated
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
Copy Markdown
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
Copy Markdown
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.

4 participants