Skip to content

room.member() cannot get member when bot set remark for friend #104

@lijiarui

Description

@lijiarui

Run npm run doctor or wechaty run doctor(for docker user), paste output here

> wechaty@0.6.22 doctor /wechaty
> ts-node bin/doctor


#### Wechaty Doctor

1. Wechaty version: 0.6.22
2. Linux x64 version 4.4.27-moby memory 1342/1997 MB
3. Docker: true
4. Node version: v7.1.0

Steps to reproduce the behavior (and fixes, if any)

When the bot modify it's friend's nickname [Alice] to remarkname [AliceRevise], the other user in the room want to use [@alice] to let the bot know he wants to do something to Alice, but when use function room.member('Alice') , the bot cannot find Alice by Nickname, when change to @AliceRevise, using function room.member('AliceRevise'),then the bot can find Alice.

I found function room.member() try to detect nickMap in the room to find the contact, when the bot modifies nickname, you assign RemarkName to nickMap, so the bot cannot use room.member() find the user.

I guess it's a bug, you should assign NickName not RemarkName to nickMap.

Paste the full output logs here with WECHATY_LOG=silly set

SILL Room member() check nickMap: {"@f617961475d7d90e6f22d24caff884ef":"李佳芮","@76185926dff01e5b6210944001d9cd0c":"AliceRevise","@48614ff69405db58046563bdb7f1385012f13e64a6b588b22b7c888ea52e0f0d":"kz社区","@152c1e75119f393005532ea3131ad2b2":"Love-U-Unconditionally","@c536eee2244de14c707bdde0c8f11d658ffe3f5562953f72ad34ced3a7e1c054":"桔子"}

console.log(room) result as follows:

Room {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  id: '@@7bcae57dcded44e764b90f62f4a2dc5ae08d30a34a9488aa96bf2ed3e3ee6feb',
  rawObj:
   { Alias: '',
     AppAccountFlag: 0,
     AttrStatus: 0,
     ChatRoomId: 0,
     City: '',
     ContactFlag: 0,
     DisplayName: '',
     EncryChatRoomId: '@34633f0f3a40068585fa11489b6442b9',
     HeadImgUrl: '/cgi-bin/mmwebwx-bin/webwxgetheadimg?seq=0&username=@@7bcae57dcded44e764b90f62f4a2dc5ae08d30a34a9488aa96bf2ed3e3ee6feb&skey=',
     HideInputBarFlag: 0,
     KeyWord: '',
     MMFromBatchGet: true,
     MMFromBatchget: true,
     MMInChatroom: true,
     MMOrderSymbol: '~',
     MemberCount: 5,
     MemberList: [ [Object], [Object], [Object], [Object], [Object] ],
     NickName: '李佳芮,Alice,kz社区,Love-U-Unconditionally,',
     OwnerUin: 481452587,
     PYInitial: '',
     PYQuanPin: '',
     Province: '',
     RemarkName: '',
     RemarkPYInitial: '',
     RemarkPYQuanPin: '',
     Sex: 0,
     Signature: '',
     SnsFlag: 0,
     StarFriend: 0,
     Statues: 1,
     Uin: 0,
     UniFriend: 0,
     UserName: '@@7bcae57dcded44e764b90f62f4a2dc5ae08d30a34a9488aa96bf2ed3e3ee6feb',
     VerifyFlag: 0,
     stranger: true },
  obj:
   { id: '@@7bcae57dcded44e764b90f62f4a2dc5ae08d30a34a9488aa96bf2ed3e3ee6feb',
     encryId: '@34633f0f3a40068585fa11489b6442b9',
     topic: '李佳芮,Alice,kz社区,Love-U-Unconditionally,',
     ownerUin: 481452587,
     memberList: [ [Object], [Object], [Object], [Object], [Object] ],
     nickMap:
      Map {
        '@f617961475d7d90e6f22d24caff884ef': '李佳芮',
        '@76185926dff01e5b6210944001d9cd0c': 'AliceRevise',
        '@48614ff69405db58046563bdb7f1385012f13e64a6b588b22b7c888ea52e0f0d': 'kz社区',
        '@152c1e75119f393005532ea3131ad2b2': 'Love-U-Unconditionally',
        '@c536eee2244de14c707bdde0c8f11d658ffe3f5562953f72ad34ced3a7e1c054': '桔子' } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions