Skip to content
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

should refresh room data when there is a room event #1328

Closed
4 tasks done
lijiarui opened this issue Jun 13, 2018 · 3 comments
Closed
4 tasks done

should refresh room data when there is a room event #1328

lijiarui opened this issue Jun 13, 2018 · 3 comments
Assignees
Labels

Comments

@lijiarui
Copy link
Member

lijiarui commented Jun 13, 2018

wechaty version: 0.15.150

should refresh room data when there is the following room event:

  • join
  • topic
  • leave
  • create
@lijiarui
Copy link
Member Author

lijiarui commented Jun 14, 2018

Wechaty Version:

2725f1a (commit number over update the cache after room events (#1328))

Bug

Cannot refresh room member and room topic when there is a room event.

Reproduce Step

  1. run example/room-bot.ts and add some log in the code as the following showed:
     /**
       * find room name start with "ding"
       */
      try {
        const dingRoom = await this.Room.find({ topic: /^ding/i })
        if (dingRoom) {
          /**
           * room found
           */
          log.info('Bot', 'onMessage: got dingRoom: %s', dingRoom.topic())

          if (dingRoom.has(from)) {
            /**
             * speaker is already in room
             */
            const topic = await dingRoom.topic()
            log.info('Bot', 'onMessage: sender has already in dingRoom')
            dingRoom.say('no need to ding again, because you are already in ding room', from)
            from.say(`I found you have joined in room ${topic}!`)
            // sendMessage({
            //   content: 'no need to ding again, because you are already in ding room'
            //   , to: sender
            // })

          } else {
            /**
             * put speaker into room
             */
            log.info('Bot', 'onMessage: add sender(%s) to dingRoom(%s)', from.name(), dingRoom.topic())
            from.say('ok, I will put you in ding room!')
            putInRoom(from, dingRoom)
          }
  1. I change the room topic from ding - welcome 李佳芮 to ding - warn 李佳芮
  2. Bot removed me form the room
  3. I send ding to bot:

Expect:

join the ding room

Actual:

  • bot reply me peer to peer,say: I found you have joined in room ding - welcome 李佳芮!
  • bot send message @李佳芮 no need to ding again, because you are already in ding room in room ding - warn 李佳芮.
  • ding - welcome 李佳芮 topic didn't refresh to ding - warn 李佳芮

Log

19:00:59 INFO Bot onMessage: got dingRoom: [object Promise]
19:00:59 VERB PuppetPadchat roomMemberList(6350854677@chatroom)
19:00:59 VERB PuppetPadchatManager getRoomMemberIdList(6350854677)
19:00:59 VERB PuppetPadchatManager getRoomMemberIdList(6350854677) length=2
19:00:59 VERB Room topic()
19:00:59 SILL PuppetPadchat roomMemberList()=2
19:00:59 INFO Bot onMessage: sender has already in dingRoom
19:00:59 VERB Room say(no need to ding again, because you are already in ding room, 李佳芮)
19:00:59 VERB PuppetPadchat messageSend({"roomId":"6350854677@chatroom","contactId":"qq512436430"}, @李佳芮 no need to ding again, because you are already in ding room)
19:00:59 SILL PadchatRpc rpcCall(WXSendMsg, ["6350854677@chatroom","@李佳芮 no need to ding again, because you are already in ding room",""])
19:00:59 VERB Contact say(I found you have joined in room ding - welcome 李佳芮!)
19:00:59 VERB PuppetPadchat messageSend({"contactId":"qq512436430"}, I found you have joined in room ding - welcome 李佳芮!)
19:00:59 SILL PadchatRpc rpcCall(WXSendMsg, ["qq512436430","I found you have joined in room ding - welcome 李佳芮!",""])

@lijiarui
Copy link
Member Author

fix

@huan
Copy link
Member

huan commented Jun 14, 2018

Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants