wechaty / wechaty-puppet-padpro

Apache License 2.0
238 stars 64 forks source link

bot.Room.create 报错ERR Room create() exception: Error: no id #178

Open scholar-wei opened 5 years ago

scholar-wei commented 5 years ago

重要:请不要删除模板自行填写,所有不按照模板填写的issue,我们将不会处理。

1. 提供你的包版本信息

2. Bug 描述

创建群聊频繁出现no id错误

3. 复现的步骤 (或者解决的步骤)

bot扫码登录之后,重启bot自动登录成功之后,创建群聊,频繁出现 ERR Room create() exception: Error: no id

相关代码:

try {
      const ContactA = await bot.Contact.find({name:'源'})
      const ContactB = await bot.Contact.find({name:'H'})
      const contactList = [ContactA, ContactB];
      console.log('Bot', 'contactList: %s', contactList.join(','))
      const room = await bot.Room.create(contactList, '新鲜群啊');
      console.log('Bot', 'createDingRoom() new ding room created: %s', room)
      // 官方提供的create方法不能直接修改群名,必须先sync,再topic
      await room.sync();
      await room.topic('新鲜群啊');
      await room.say(`测试建群`);
} catch (error) {
      console.log(error);
}

4. 期待程序运行的结果

能够成功创建群聊

5. 程序实际运行的结果

提示错误 ERR Room create() exception: Error: no id

6. 完整的日志信息:

通过WECHATY_LOG=silly设定环境变量,将设置log 等级为 silly,获取最详细的日志信息(默认log 等级为 info) 请提供完整的日志信息(不要只提供部分的日志截图,请复制粘贴日志内容!)

Bot contactList: %s Contact<袁健源>,Contact<侯文豪> 10:12:39 VERB Room create(Contact<袁健源>,Contact<侯文豪>, 新鲜群啊) 10:12:40 VERB Puppet roomPayload() 10:12:40 ERR Room create() exception: Error: no id at PuppetPadpro. (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:692:23) at Generator.next () at /Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:25:71 at new Promise () at __awaiter (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:21:12) at PuppetPadpro.roomPayload (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:689:16) at PuppetPadpro. (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet-padpro@0.3.5@wechaty-puppet-padpro/dist/src/puppet-padpro.js:1194:24) at Generator.next () at fulfilled (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet-padpro@0.3.5@wechaty-puppet-padpro/dist/src/puppet-padpro.js:22:58) Error: no id at PuppetPadpro. (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:692:23) at Generator.next () at /Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:25:71 at new Promise () at __awaiter (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:21:12) at PuppetPadpro.roomPayload (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet@0.15.25@wechaty-puppet/dist/src/puppet.js:689:16) at PuppetPadpro. (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet-padpro@0.3.5@wechaty-puppet-padpro/dist/src/puppet-padpro.js:1194:24) at Generator.next () at fulfilled (/Users/weieryang/work/iyunxiao_code/wechat_bot_server/node_modules/_wechaty-puppet-padpro@0.3.5@wechaty-puppet-padpro/dist/src/puppet-padpro.js:22:58) ```shell $ WECHATY_LOG=silly node yourbot.js ```

7. 其他信息

[bug]

arno-react commented 5 years ago

我也这样

arno-react commented 5 years ago

我报这个错误原因是 加群的人数太多了。有提示一次最多40人。

scholar-wei commented 5 years ago

我报这个错误原因是 加群的人数太多了。有提示一次最多40人。

我这边一次最多就加两个人,群成员也就是五六个

su-chang commented 5 years ago

这个问题可能是查找联系人出现异常所导致的,需要使用 wxid 来进行查找

使用 await bot.Contact.load('xxxxxxxxxxx') 获取联系人信息

即使用 contact.id 来获取联系人信息,请勿使用 contact.weixin() 获取联系人信息

从而使用获得的 contactList 创建群组

注意:每天创建群组的数量和频次请自行把控

scholar-wei commented 5 years ago

这个问题可能是查找联系人出现异常所导致的,需要使用 wxid 来进行查找

使用 await bot.Contact.load('xxxxxxxxxxx') 获取联系人信息

即使用 contact.id 来获取联系人信息,请勿使用 contact.weixin() 获取联系人信息

从而使用获得的 contactList 创建群组

注意:每天创建群组的数量和频次请自行把控

我上面的例子是使用find({name:''})查询的啊,并没有使用load,不存在使用weixin去load的情况。