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 `room-bot-leave` event #250

Closed
lijiarui opened this Issue Feb 13, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@lijiarui
Member

lijiarui commented Feb 13, 2017

We have a room-event when bot removed others from the room, but when others removed the bot from the room, we don't have any event.

So I suggest adding an event when the bot is removed from the owner of one room.

Then I have a question:

what name should we used for this event?

1. room-bot-leave
2. room-leave: use leaverList to identify the differences.

I prefer the room-bot-leave, because I think bot remove others from the room and others remove bot from the room used in different scene.

Sys Message as follows:

You were removed from the group chat by "桔小秘"
你被"李佳芮"移出群聊

@zixia zixia added the enhancement label Feb 13, 2017

@lijiarui

This comment has been minimized.

Show comment
Hide comment
@lijiarui

lijiarui Feb 14, 2017

Member

@zixia What do you think about it?

Member

lijiarui commented Feb 14, 2017

@zixia What do you think about it?

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Feb 14, 2017

Member

I agree that when the bot is removed out of a room, the leave event should be fired.

And I agree with your option 2. When bot itself is removed, leaverList will include the bot, and we can use Contact.self() to identify if a leaver is the bot.

The existing event leave / room-leave have already covered this scenario which makes great sence; I think there's no need to introduce a new event.

PR is welcome.

Member

zixia commented Feb 14, 2017

I agree that when the bot is removed out of a room, the leave event should be fired.

And I agree with your option 2. When bot itself is removed, leaverList will include the bot, and we can use Contact.self() to identify if a leaver is the bot.

The existing event leave / room-leave have already covered this scenario which makes great sence; I think there's no need to introduce a new event.

PR is welcome.

@lijiarui

This comment has been minimized.

Show comment
Hide comment
@lijiarui

lijiarui Feb 14, 2017

Member

@zixia If we use option 2, do you think we should tell who removed the bot from the room?

If we want to tell the user who removed the bot from the room, we cannot just use leaver, we should add a parameter like remover.

It may seems like this:

.on('room-leave', function(this, room, leaver, remover) {
  log.info('Bot', 'EVENT: room-leave - Room %s lost member %s by %s'
                , room.topic()
                , leaverList.map(c => c.name()).join(',')
                , remover.name()
              )
})

1.If the bot removes a contact from the group:

leaver = contact
remover = bot

2.If the others remove the bot from the group:

leaver = bot
remover = contact

Member

lijiarui commented Feb 14, 2017

@zixia If we use option 2, do you think we should tell who removed the bot from the room?

If we want to tell the user who removed the bot from the room, we cannot just use leaver, we should add a parameter like remover.

It may seems like this:

.on('room-leave', function(this, room, leaver, remover) {
  log.info('Bot', 'EVENT: room-leave - Room %s lost member %s by %s'
                , room.topic()
                , leaverList.map(c => c.name()).join(',')
                , remover.name()
              )
})

1.If the bot removes a contact from the group:

leaver = contact
remover = bot

2.If the others remove the bot from the group:

leaver = bot
remover = contact

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Feb 14, 2017

Member

Of course. If we can "tell who removed the bot from the room", then tell it.

Your design looks perfect.

Member

zixia commented Feb 14, 2017

Of course. If we can "tell who removed the bot from the room", then tell it.

Your design looks perfect.

@zixia zixia closed this in #370 Apr 16, 2017

zixia added a commit that referenced this issue Apr 16, 2017

add room-leave event (#370) (fix #250)
* fix room.member() bug

* add test data

* change contactAlias

* del room.member filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment