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 attachment support on top of v0.1.4 #148

Merged
merged 1 commit into from
Jul 18, 2016
Merged

add attachment support on top of v0.1.4 #148

merged 1 commit into from
Jul 18, 2016

Conversation

nanaeasiedu
Copy link
Contributor

This adds attachment support.

@geekgonecrazy
Copy link
Contributor

lgtm thanks @ngenerio !

@geekgonecrazy geekgonecrazy merged commit 72bbf02 into RocketChat:master Jul 18, 2016
@geekgonecrazy
Copy link
Contributor

@ngenerio can you give us an example on how you'd use this? I'd like to add it to our documentation.

@nanaeasiedu
Copy link
Contributor Author

nanaeasiedu commented Aug 22, 2016

@geekgonecrazy Sure. When a user sends a message to hubot prior to this pull request, there was no way to get information concerning the attachment. The message.text was undefined.

Now, you can simply do this:

robot.respond /some string/, (resp) ->
  if resp.message.attachment?
    {attachment} = resp.message
    console.log attachment.type, attachment.link
    # or probably store it in hubot's brain

to know if there was an attachment to the message and perform some action based on that. I hope this helps.

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.

2 participants