Closed zhongyufan closed 11 months ago
建议使用@juzi这个scope下的wechaty依赖包再试下。
await contact.tags()
好的 帮忙看下这个问题,启动的时候报错
"@juzi/wechaty": "1.0.74",
"@juzi/wechaty-puppet-service": "1.0.79",
找到问题了,我在同一个nest服务中加载了 @juzi/wechaty 和 wechaty 就会出现上图的情况,如何让同个服务支持企微和微信?
"@juzi/wechaty": "1.0.74", "wechaty": "^1.20.2",
这两个服务是单独的接口,不知怎么就互相影响了
这个我觉得是可以做到的,但具体怎么实现,因为不了解你的代码结构,所以不好说。 可以提供的建议是,@juzi/wechaty对于原有的各种puppet也是可以兼容的,最多有些新功能不好使。所以你可以用@juzi的去连接个微token。
好的 我尝试下
@juzi/wechaty 这个包会有很多log,如何关闭这些内部的log?
@juzi/wechaty 这个包会有很多log,如何关闭这些内部的log? 将 WECHATY_LOG 环境变量配置为 silent
在群里使用say,并且@多个人员的时候会提示下面这个报错 人员是通过await bot.Contact.find({ id: i })查询的数组
for (const i of mention) {
contact.push(await bot.Contact.find({ id: i }));
}
Error: mentionList must be contact when not using TemplateStringsArray function call.
目前只能使用下面这个方法进行发送 room.say('123', { mentionList: contact, }) 不使用对象参数的话只能提及一人 是这样的吗?
const contacts = [A, B, C]
await room.say(text, ...contacts)
这个我觉得是可以做到的,但具体怎么实现,因为不了解你的代码结构,所以不好说。 可以提供的建议是,@juzi/wechaty对于原有的各种puppet也是可以兼容的,最多有些新功能不好使。所以你可以用@juzi的去连接个微token。
目前使用了句子的包调用wechaty-puppet-wechat,生成二维码授权后会报以下错误
14:27:24 ERR PuppetWeChatBridge onLoad() exception: Error: execute proxyWechaty(init) error: 503, init() without a ready angular env
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
GError: execute proxyWechaty(init) error: 503, init() without a ready angular env
at Bridge.inject (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:266:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Bridge.onLoad (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:148:13)
Emitted 'error' event on WechatyImpl instance at:
at WechatyImpl.emit (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/@juzi+wechaty@1.0.74_@juzi+wechaty-puppet@1.0.67_brolog@1.14.2_redux@4.2.1_rxjs@7.8.1/node_modules/@juzi/wechaty/dist/esm/src/wechaty-mixins/gerror-mixin.js:45:26)
at PuppetWeChat.<anonymous> (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/@juzi+wechaty@1.0.74_@juzi+wechaty-puppet@1.0.67_brolog@1.14.2_redux@4.2.1_rxjs@7.8.1/node_modules/@juzi/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:165:34)
at PuppetWeChat.emit (node:events:514:28)
at PuppetWeChat.emit (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet@1.20.2_rxjs@7.8.1/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-skeleton.js:107:22)
at Bridge.<anonymous> (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:168:45)
at Bridge.emit (node:events:514:28)
at file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:37:42
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 2,
details: 'Error: execute proxyWechaty(init) error: 503, init() without a ready angular env\n' +
' at Bridge.inject (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:266:23)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async Bridge.onLoad (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:148:13)'
}
Node.js v20.5.0
这是编写的测试代码
// import { WechatyBuilder } from "wechaty";
import { WechatyBuilder } from "@juzi/wechaty";
import qr from "qrcode-terminal";
const wechaty = WechatyBuilder.build({
name: "wechat-puppet",
puppet: "wechaty-puppet-wechat",
}); // get a Wechaty instance
wechaty
.on("scan", (qrcode, status) => {
qr.generate(qrcode); // 在console端显示二维码
console.log(
`Scan QR Code to login: ${status}\nhttps://wechaty.js.org/qrcode/${encodeURIComponent(
qrcode
)}`
);
})
.on("login", (user) => console.log(`User ${user} logged in`))
.on("message", (message) => console.log(`Message: ${message}`));
wechaty.start();
const contacts = [A, B, C] await room.say(text, ...contacts)
好的,谢谢
这个我觉得是可以做到的,但具体怎么实现,因为不了解你的代码结构,所以不好说。 可以提供的建议是,@juzi/wechaty对于原有的各种puppet也是可以兼容的,最多有些新功能不好使。所以你可以用@juzi的去连接个微token。
目前使用了句子的包调用wechaty-puppet-wechat,生成二维码授权后会报以下错误
14:27:24 ERR PuppetWeChatBridge onLoad() exception: Error: execute proxyWechaty(init) error: 503, init() without a ready angular env node:internal/process/promises:289 triggerUncaughtException(err, true /* fromPromise */); ^ GError: execute proxyWechaty(init) error: 503, init() without a ready angular env at Bridge.inject (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:266:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Bridge.onLoad (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:148:13) Emitted 'error' event on WechatyImpl instance at: at WechatyImpl.emit (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/@juzi+wechaty@1.0.74_@juzi+wechaty-puppet@1.0.67_brolog@1.14.2_redux@4.2.1_rxjs@7.8.1/node_modules/@juzi/wechaty/dist/esm/src/wechaty-mixins/gerror-mixin.js:45:26) at PuppetWeChat.<anonymous> (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/@juzi+wechaty@1.0.74_@juzi+wechaty-puppet@1.0.67_brolog@1.14.2_redux@4.2.1_rxjs@7.8.1/node_modules/@juzi/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:165:34) at PuppetWeChat.emit (node:events:514:28) at PuppetWeChat.emit (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet@1.20.2_rxjs@7.8.1/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-skeleton.js:107:22) at Bridge.<anonymous> (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:168:45) at Bridge.emit (node:events:514:28) at file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:37:42 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 2, details: 'Error: execute proxyWechaty(init) error: 503, init() without a ready angular env\n' + ' at Bridge.inject (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:266:23)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async Bridge.onLoad (file:///Users/zhong/Desktop/code/%E5%AD%A6%E4%B9%A0/test/node_modules/.pnpm/wechaty-puppet-wechat@1.18.4_brolog@1.14.2_gerror@1.0.16_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:148:13)' } Node.js v20.5.0
这是编写的测试代码
// import { WechatyBuilder } from "wechaty"; import { WechatyBuilder } from "@juzi/wechaty"; import qr from "qrcode-terminal"; const wechaty = WechatyBuilder.build({ name: "wechat-puppet", puppet: "wechaty-puppet-wechat", }); // get a Wechaty instance wechaty .on("scan", (qrcode, status) => { qr.generate(qrcode); // 在console端显示二维码 console.log( `Scan QR Code to login: ${status}\nhttps://wechaty.js.org/qrcode/${encodeURIComponent( qrcode )}` ); }) .on("login", (user) => console.log(`User ${user} logged in`)) .on("message", (message) => console.log(`Message: ${message}`)); wechaty.start();
从这个报错的stack看,是puppet-wechat内部报出来的,我这里也不是很了解。。
暂无反馈,关闭该issue。
联系人设置了标签,但是通过Contact.findAll() 获取不到,显示tags为[]
疑问: 如何设置标签 如何获取标签