`Room.find()` can find the room when the bot is removed from the room
Created by: lijiarui
npm run doctor
or wechaty run doctor
(for docker user), paste output here
Run > wechaty@0.7.32 doctor /Users/lijiarui/Documents/git/wechaty
> npm run check-node-version && ts-node bin/doctor
> wechaty@0.7.32 check-node-version /Users/lijiarui/Documents/git/wechaty
> check-node-version --node ">= 6.9"
node: v7.0.0
npm: v4.0.5
#### Wechaty Doctor
1. Wechaty version: #git[7faecd6 0.7.32]
2. Darwin x64 version 14.5.0 memory 831/16384 MB
3. Docker: false
4. Node version: v7.0.0
5. Tcp IPC TEST: PASS
Expected behavior
When the bot is removed from the room, function Room.find()
shouldn't find the room.
Actual behavior
When the bot is removed from the room, function Room.find()
shouldn't find the room.
Steps to reproduce the behavior (and fixes, if any)
1. Trying the following code
.on('login' , async user => {
log.info('Bot', `${user.name()} logined`)
bot.say('Wechaty login')
setTimeout (async function(){
await testRoom()
}, 10 * 1000)
setTimeout (async function(){
await testRoom()
}, 200 * 1000)
})
async function testRoom() {
const room = await Room.find({topic:'呵呵呵呵'})
if (room) {
room.refresh()
console.log('========find the room ===========')
console.log(room)
} else {
console.log('========cannot find the room==========')
}
}
When running the first function await testRoom()
, the bot in the room, all works well.
Then I removed the bot from the room.
When running the second function await testRoom()
, the bot isn't in the room, and I check the web weixin, the bot isn't in the room, but it still can find the room, all the data are same as the first one.
2. Relogin with the existed session using the code above
It still can find the room, but the memberList is null.
log as follows:
Room {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
id: '@@68830d9c45cfcc6dce9830e1962895879d61d511d27a209ebfd9949dd5ab1ddd',
rawObj:
{ Alias: '',
AttrStatus: 0,
ChatRoomOwner: '@f3be6437726924c11b2d4ac8de32771f9241b01b1bd0f56cdc0c7946b3a550dc',
City: '',
ContactFlag: 2,
ContactType: 0,
HeadImgUpdateFlag: 1,
HeadImgUrl: '/cgi-bin/mmwebwx-bin/webwxgetheadimg?seq=0&username=@@68830d9c45cfcc6dce9830e1962895879d61d511d27a209ebfd9949dd5ab1ddd&skey=@crypt_74655fd7_25ff145d207e4ce54116970ee5609818',
HideInputBarFlag: 0,
KeyWord: '',
MMOrderSymbol: '~',
MemberCount: 0,
MemberList: [],
NickName: '呵呵呵呵',
PYInitial: '',
PYQuanPin: '',
Province: '',
RemarkName: '',
RemarkPYInitial: '',
RemarkPYQuanPin: '',
Sex: 0,
Signature: '',
SnsFlag: 0,
Statues: 0,
UserName: '@@68830d9c45cfcc6dce9830e1962895879d61d511d27a209ebfd9949dd5ab1ddd',
VerifyFlag: 0,
stranger: true },
obj: null }
WARN Room ready() has obj.id but memberList empty in room 呵呵呵呵. reloading