'room-leave' Event couldn't be detected when member leave the room
Created by: lijiarui
npm run doctor
and paste the output here
Please run Wechaty Doctor
- Wechaty version: #git[93d1728b doc]
- Darwin x64 version 15.6.0 memory 27/4096 MB
- Docker: false
Expected behavior
I run room-bot.ts you gave to learn room-leave event, I tried the following ways:
1.Room owner removes somebody from the room----All works well.
2.Somebody leave one room initiative----Can not detect the event.
Actual behavior
1.Room owner removes somebaoy from the room ,the log as follows:
SILL Message constructor() #5 (closed) SILL Message ready() SILL Contact ready() SILL Contact ready() SILL Room ready() VERB PuppetWebFirer checkRoomJoin(你将"李佳芮"移出了群聊) SILL PuppetWebFirer fireRoomJoin() "你将"李佳芮"移出了群聊" is not a join message VERB PuppetWebFirer fireRoomLeave(你将"李佳芮"移出了群聊) SILL PuppetWebFirer fireRoomLeave() got leaver: 李佳芮 VERB Room member(李佳芮) SILL Room member() check nickMap: {"@9d7695ce0c750586aa60d172c7a5b6bb0f7aae1d21dcf7ca982c5300ee49f4b9":"桔子秘小姐","@65310075f4ebd77620fc5a356a879e69305a3570ee3623a56e30223b90f1828a":"桔子<span class="emoji emoji1f633">","@67ff3dc01b5a21227c7913ad7ec03713":"李佳芮"} SILL Contact ready() SILL Message ready() SILL Contact ready() SILL Room ready() SILL Contact ready() INFO Bot EVENT: room-leave - Room test2 lost member 李佳芮 SILL Room ready() [test2]:{SYS}你将"李佳芮"移出了群聊
2.Somebody leave the room initiative
no log.....
then , I send a message in the room, the log as follows:
SILL Message constructor() #7 (closed) SILL Message ready() SILL Contact ready() SILL Contact ready() SILL Room ready() SILL Message ready() SILL Contact ready() SILL Contact ready() SILL Room ready() [test2]<桔子秘小姐>:{TEXT}刚刚 WARN Wechaty self() method deprecated. use Message.self() instead WARN PuppetWeb self() method deprecated. use Message.self() instead
SILL Message constructor() #6 (closed) is the operation : Room Owner add the one he removed to the room again....
I guess, the somebody left the room initiative should be "SILL Message constructor() #7 (closed)" but it is ignored....
In other words, the operation should be in the following order: 1.SILL Message constructor() #5 (closed)---- room owner remover "李佳芮" from the room 2.SILL Message constructor() #6 (closed)----room owner invite "李佳芮" to the room 3.SILL Message constructor() #7 (closed)---- "李佳芮" leave room initiative 4.SILL Message constructor() #8 (closed)----"桔子蜜小姐" say "刚刚" in the room
but, what happened is the following order: 1.SILL Message constructor() #5 (closed)---- room owner remover "李佳芮" from the room 2.SILL Message constructor() #6 (closed)----room owner invite "李佳芮" to the room 3.SILL Message constructor() #7 (closed)----"桔子蜜小姐" say "刚刚" in the room
It means "李佳芮" leave room initiative isn't detected by the bot.
Steps to reproduce the behavior (and fixes, if any)
I guess the reason maybe is the room can't detect member leave initiative because there is no SYS message in the room. Then I have a suggestion, could you detect the member change situation when the room is first activated(such as one say something in the room) when one left the room?
Because of the following 2 reasons: 1.Compared to the owner remove someone from the room, room owner may more care the one who leaves initiative... 2.Remove SYS message only could be seen by room owner and the one who is removed, others in the room can't see this sys message, that means when the bot isn't used as a room owner, 'room-join' event can't be detected anymore.