Skip to content

robot.enter and robot.leave doesn't work #296

Closed
@Kenshinhu

Description

@Kenshinhu

I build hubot-slack in 3.4.2

I write it on example.coffee , but isn't work .

It's mean tigger enter on click bot's use?
It's mean tigger leave on click other use?

`module.exports = (robot) ->

         robot.enter (msg) ->.....

         robot.leave (msg) ->.....`

Activity

UncannyBingo

UncannyBingo commented on Jun 25, 2016

@UncannyBingo

Hello, would love to help out, but I'm afraid I need more details on your problem. Can you post a more detailed chunk of code that illustrates the problem you are having?

leonfortej

leonfortej commented on Aug 19, 2016

@leonfortej

Having the same problem, pulled code directly from samples. Never kicks off.

module.exports = (robot) ->
enterReplies = ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you']
leaveReplies = ['Are you still there?', 'Target lost', 'Searching']

module.exports = (robot) ->
robot.enter (res) ->
res.send res.random enterReplies
robot.leave (res) ->
res.send res.random leaveReplies

aoberoi

aoberoi commented on Oct 17, 2017

@aoberoi
Contributor

the adapter seem to be hooked up correctly to channel_join and group_join events. @leonfortej @Kenshinhu are you sure you are using the API correctly? specifically, the messages should trigger when any user joins or leaves a channel that the bot is in. if that's what you expected and it didn't work, let me know so i can try to reproduce it.

changed the title How to Work for enter/leave event? robot.enter and robot.leave doesn't work on Oct 17, 2017
added
needs infoAn issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info
on Oct 17, 2017
JoniSykes

JoniSykes commented on Oct 18, 2017

@JoniSykes

I'm testing Hubot with Slack now and I can get the channel enter to trigger but not the channel leave.
Upon entering the channel a user is greeted with one of my custom greetings.
When a user leaves the channel.....nothing.

added
bugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented
and removed
needs infoAn issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info
on Oct 19, 2017
aoberoi

aoberoi commented on Oct 19, 2017

@aoberoi
Contributor

@JoniSykes thanks for the feedback! you inspired me to try reproducing the problem and even before getting there, i think i found it.

the current implementation relies on RTM "message" events, with subtype "channel_join"/"group_join" and "channel_leave"/"group_leave". Back in May, there was an announcement that Slack no longer guaranteed delivery of these events, in favor of new events with types "member_joined_channel" and "member_left_channel".

we need to update the implementation of the adapter to listen for and handle those events to generate the EnterMessage and LeaveMessage objects.

alagos

alagos commented on Nov 27, 2017

@alagos

👍
Weird stuff is, I already have a bot working in a slack space with a greeting message for new users, but I created another space today with this same script and is not working:

module.exports = (robot) ->
  robot.enter (msg) ->
    general = robot.adapter.client.rtm.dataStore.getChannelByName '#general'
    if msg.message.room == general.id
      robot.send {room: msg.message.user.id}, "Hi, *#{msg.message.user.name}*! :wave:"

I tried with the same hubot/hubot-slack versions, but nothing happens.

aoberoi

aoberoi commented on Dec 18, 2017

@aoberoi
Contributor

@alagos thanks for the data point. the best i can do to explain that is to say that the older event types are no longer guaranteed, so its possible that the differences in your workspaces are responsible for the different behavior.

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedgood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      robot.enter and robot.leave doesn't work · Issue #296 · slackapi/hubot-slack