{"action":"created","issue":{"url":"https://api.github.com/repos/Chatie/wechaty/issues/1328","repository_url":"https://api.github.com/repos/Chatie/wechaty","labels_url":"https://api.github.com/repos/Chatie/wechaty/issues/1328/labels{/name}","comments_url":"https://api.github.com/repos/Chatie/wechaty/issues/1328/comments","events_url":"https://api.github.com/repos/Chatie/wechaty/issues/1328/events","html_url":"https://github.com/Chatie/wechaty/issues/1328","id":331989885,"node_id":"MDU6SXNzdWUzMzE5ODk4ODU=","number":1328,"title":"should refresh room data when there is a room event","user":{"login":"lijiarui","id":6419514,"node_id":"MDQ6VXNlcjY0MTk1MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/6419514?v=4","gravatar_id":"","url":"https://api.github.com/users/lijiarui","html_url":"https://github.com/lijiarui","followers_url":"https://api.github.com/users/lijiarui/followers","following_url":"https://api.github.com/users/lijiarui/following{/other_user}","gists_url":"https://api.github.com/users/lijiarui/gists{/gist_id}","starred_url":"https://api.github.com/users/lijiarui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijiarui/subscriptions","organizations_url":"https://api.github.com/users/lijiarui/orgs","repos_url":"https://api.github.com/users/lijiarui/repos","events_url":"https://api.github.com/users/lijiarui/events{/privacy}","received_events_url":"https://api.github.com/users/lijiarui/received_events","type":"User","site_admin":false},"labels":[{"id":367767329,"node_id":"MDU6TGFiZWwzNjc3NjczMjk=","url":"https://api.github.com/repos/Chatie/wechaty/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"zixia","id":1361891,"node_id":"MDQ6VXNlcjEzNjE4OTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1361891?v=4","gravatar_id":"","url":"https://api.github.com/users/zixia","html_url":"https://github.com/zixia","followers_url":"https://api.github.com/users/zixia/followers","following_url":"https://api.github.com/users/zixia/following{/other_user}","gists_url":"https://api.github.com/users/zixia/gists{/gist_id}","starred_url":"https://api.github.com/users/zixia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zixia/subscriptions","organizations_url":"https://api.github.com/users/zixia/orgs","repos_url":"https://api.github.com/users/zixia/repos","events_url":"https://api.github.com/users/zixia/events{/privacy}","received_events_url":"https://api.github.com/users/zixia/received_events","type":"User","site_admin":false},"assignees":[{"login":"zixia","id":1361891,"node_id":"MDQ6VXNlcjEzNjE4OTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1361891?v=4","gravatar_id":"","url":"https://api.github.com/users/zixia","html_url":"https://github.com/zixia","followers_url":"https://api.github.com/users/zixia/followers","following_url":"https://api.github.com/users/zixia/following{/other_user}","gists_url":"https://api.github.com/users/zixia/gists{/gist_id}","starred_url":"https://api.github.com/users/zixia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zixia/subscriptions","organizations_url":"https://api.github.com/users/zixia/orgs","repos_url":"https://api.github.com/users/zixia/repos","events_url":"https://api.github.com/users/zixia/events{/privacy}","received_events_url":"https://api.github.com/users/zixia/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-06-13T13:15:46Z","updated_at":"2018-06-14T11:10:18Z","closed_at":null,"author_association":"MEMBER","body":"wechaty version: 0.15.150\r\n\r\nshould refresh room data when there is the following room event:\r\n- [x] join\r\n- [x] topic\r\n- [x] leave\r\n- [x] create"},"comment":{"url":"https://api.github.com/repos/Chatie/wechaty/issues/comments/397258024","html_url":"https://github.com/Chatie/wechaty/issues/1328#issuecomment-397258024","issue_url":"https://api.github.com/repos/Chatie/wechaty/issues/1328","id":397258024,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzI1ODAyNA==","user":{"login":"lijiarui","id":6419514,"node_id":"MDQ6VXNlcjY0MTk1MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/6419514?v=4","gravatar_id":"","url":"https://api.github.com/users/lijiarui","html_url":"https://github.com/lijiarui","followers_url":"https://api.github.com/users/lijiarui/followers","following_url":"https://api.github.com/users/lijiarui/following{/other_user}","gists_url":"https://api.github.com/users/lijiarui/gists{/gist_id}","starred_url":"https://api.github.com/users/lijiarui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijiarui/subscriptions","organizations_url":"https://api.github.com/users/lijiarui/orgs","repos_url":"https://api.github.com/users/lijiarui/repos","events_url":"https://api.github.com/users/lijiarui/events{/privacy}","received_events_url":"https://api.github.com/users/lijiarui/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T11:10:18Z","updated_at":"2018-06-14T11:10:18Z","author_association":"MEMBER","body":"#### Wechaty Version: 2725f1a4a5f6fe054dbaf796748f6647ffebb589  (commit number over `update the cache after room events (#1328)`)\r\n\r\n#### Bug\r\nCannot refresh room member and room topic when there is a room event.\r\n\r\n#### Reproduce Step\r\n1. run `example/room-bot.ts` and add some log in the code as the following showed:\r\n```ts\r\n     /**\r\n       * find room name start with \"ding\"\r\n       */\r\n      try {\r\n        const dingRoom = await this.Room.find({ topic: /^ding/i })\r\n        if (dingRoom) {\r\n          /**\r\n           * room found\r\n           */\r\n          log.info('Bot', 'onMessage: got dingRoom: %s', dingRoom.topic())\r\n\r\n          if (dingRoom.has(from)) {\r\n            /**\r\n             * speaker is already in room\r\n             */\r\n            const topic = await dingRoom.topic()\r\n            log.info('Bot', 'onMessage: sender has already in dingRoom')\r\n            dingRoom.say('no need to ding again, because you are already in ding room', from)\r\n            from.say(`I found you have joined in room ${topic}!`)\r\n            // sendMessage({\r\n            //   content: 'no need to ding again, because you are already in ding room'\r\n            //   , to: sender\r\n            // })\r\n\r\n          } else {\r\n            /**\r\n             * put speaker into room\r\n             */\r\n            log.info('Bot', 'onMessage: add sender(%s) to dingRoom(%s)', from.name(), dingRoom.topic())\r\n            from.say('ok, I will put you in ding room!')\r\n            putInRoom(from, dingRoom)\r\n          }\r\n```\r\n\r\n\r\n2. I change the room topic from `ding - welcome 李佳芮` to `ding - warn 李佳芮`\r\n3.Bot remove me form the room\r\n4. I send `ding` to bot:\r\n  - Expect: \r\n     join the ding room\r\n  - Actual:\r\n    - bot reply me peer to peer,say: `I found you have joined in room ding - welcome 李佳芮!`\r\n    - bot send message `@李佳芮 no need to ding again, because you are already in ding room` in room `ding - warn 李佳芮`. \r\n    - `ding - welcome 李佳芮` topic didn't refresh to `ding - warn 李佳芮`\r\n\r\n#### Log\r\n```shell\r\n19:00:59 INFO Bot onMessage: got dingRoom: [object Promise]\r\n19:00:59 VERB PuppetPadchat roomMemberList(6350854677@chatroom)\r\n19:00:59 VERB PuppetPadchatManager getRoomMemberIdList(6350854677)\r\n19:00:59 VERB PuppetPadchatManager getRoomMemberIdList(6350854677) length=2\r\n19:00:59 VERB Room topic()\r\n19:00:59 SILL PuppetPadchat roomMemberList()=2\r\n19:00:59 INFO Bot onMessage: sender has already in dingRoom\r\n19:00:59 VERB Room say(no need to ding again, because you are already in ding room, 李佳芮)\r\n19:00:59 VERB PuppetPadchat messageSend({\"roomId\":\"6350854677@chatroom\",\"contactId\":\"qq512436430\"}, @李佳芮 no need to ding again, because you are already in ding room)\r\n19:00:59 SILL PadchatRpc rpcCall(WXSendMsg, [\"6350854677@chatroom\",\"@李佳芮 no need to ding again, because you are already in ding room\",\"\"])\r\n19:00:59 VERB Contact say(I found you have joined in room ding - welcome 李佳芮!)\r\n19:00:59 VERB PuppetPadchat messageSend({\"contactId\":\"qq512436430\"}, I found you have joined in room ding - welcome 李佳芮!)\r\n19:00:59 SILL PadchatRpc rpcCall(WXSendMsg, [\"qq512436430\",\"I found you have joined in room ding - welcome 李佳芮!\",\"\"])\r\n```"}}
{"actor":{"display_login":"lijiarui"}}