cixingguangming55555 / wechat-bot

带二次开发接口的PC微信聊天机器人
MIT License
2.46k stars 664 forks source link

3.1和3.2版本无法获取群聊的成员列表 #121

Open liulikong opened 3 years ago

liulikong commented 3 years ago

获取群聊成员列表返回的是如下格式: {"content":"{\"nick\":\"\",\"roomid\":\"***@chatroom\",\"wxid\":\"root\"}","id":"20210806160905","receiver":"CLIENT","sender":"SERVER","srvid":1,"status":"SUCCSESSED","time":"2021-08-06 16:09:07","type":5020} 大佬给看看呗

liulikong commented 3 years ago

那个wxid写成ROOT或者root都不行

cixingguangming55555 commented 3 years ago

pls send more detail to my wx

liulikong commented 3 years ago

pls send more detail to my wx

我用的是client里的WxHookDemo,触发的是BtnGetChatMemberNickname_Click方法: 调用之后收到的就是上面的内容

cixingguangming55555 commented 3 years ago

pls read the the file:http-3.2.1.121.js ,client-3.2.1.121.js,all data had seven field

liary commented 3 years ago

同样存在无法获取群聊成员列表,发送信息:

### 代码片段位置对应文件client-3.2.1.121.js的line-108###
function get_chatroom_memberlist()
{
  const j={
    id:getid(),
    type: CHATROOM_MEMBER,
    roomid:'19452544014@chatroom',//null
    wxid: 'ROOT',//not null
    content: 'sd22',//not null
    nickname:'null',
    ext:'null'
  };

  const s= JSON.stringify(j);
  console.log(`发送查找列表websocket请求内容:${s}`)
  return s;
}

执行:

### 代码片段位置对应文件client-3.2.1.121.js的line-321 ###
ws.on('open', function open()  {
  ws.send(get_chatroom_memberlist());
  }

执行后再收到消息处添加的log点如下:

### 代码片段位置对应文件client-3.2.1.121.js的line-374###
ws.on('message', function incoming(data) 
{
    let j;
    try {
      j = JSON.parse(data.toString());
    } catch(err) {
      console.error(`服务器返回数据不是对象而是一个标识${data.toString()}`);
      j = {};
    }
})

最后控制台打印信息如下:

### 控制台输出###
发送查找列表websocket请求内容:{"id":"1630253626679","type":5010,"roomid":"19452544014@chatroom","wxid":"ROOT","content":"sd22","nickname":"null","ext":"null"}
服务器返回数据不是对象而是一个标识execption

http-3.2.1.121.js里面尝试也是一样,发送群成员请求返回的内容是一个字符串结果execption,而不是期望中的成员列表

cixingguangming55555 commented 3 years ago

wxid is root?it 's wrong, it is similar wxid_