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

Enter/leave messages don't have timestamps #575

Open
sinisterstuf opened this issue Aug 22, 2019 · 1 comment

Comments

@sinisterstuf
Copy link
Contributor

commented Aug 22, 2019

Description

Marking this as question because I'm not sure it's a bug. I've noticed that the enter and leave events are missing a timestamp (I will talk about only enter events from here on because leave events behave the same).

Most things in the eventHandler return a timestamp from event.ts or event.event_ts. Enter events do not: (source)

    else if event.type is "member_joined_channel"
      # this event type always has a channel
      user.room = channel
      @robot.logger.debug "Received enter message for user: #{user.id}, joining: #{channel}"
      @receive new EnterMessage user

The only thing it passes to @receive is user, and you can see as much if you console.log what you get when using robot.enter as a script developer; you have user data and that's it.

My use case is: I'd like the robot to apply emoji reactions to the message for the enter event in Slack but that action requires a timestamp and a channel. I can get the channel from room, kinda, but I don't have the message timestamp.

To be honest it's not clear to me whether that RTM event even contains a timestamp or not because the documentation for member_joined_channel does not include a timestamp in the example even though the example in the 2017 blog post introducing this event does include one. What's for sure is that the message/channel_join did include a timestamp and probably its frequency would be sufficient for my use case but we moved away from using that in #513.

If the RTM event member_joined_channel does include a timestamp, this is perfect and I will create a pull request to try to propogate that timestamp to Hubot. How can I find that out?

If it does not have one, then it is probably intentional and in that case, how can I work around the now-missing message/channel_join which has the timestamp I need?

Sorry for the wall of text 😅

What type of issue is this?

  • question

Requirements

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

@sinisterstuf sinisterstuf changed the title Enter/join don't have timestamps Enter/leave messages don't have timestamps Aug 22, 2019

@sinisterstuf

This comment has been minimized.

Copy link
Contributor Author

commented Aug 22, 2019

OK after a bit of experimentation and a message back and forth with Slack support I can confirm that member_joined_channel and member_left_channel both have timestamps, so I'm going to give a go at a pull request for this later.

Two impediments I can foresee:

  1. I'll need some guidance on appropriate unit tests for this
  2. I have no idea how I could actually reproduce this and prove that it works except for trying it out in production, how is this usually done?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.