wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
774 stars 342 forks source link

Contact的alias方法的问题 #235

Closed J1angX1n closed 2 years ago

J1angX1n commented 2 years ago

我参考官方的api想测试我的微信机器人,但是每次当我想用alias方法去尝试修改好友备注的时候控制台就会疯狂地循环打印信息,是我有什么地方调用出错了吗 我的代码:

async (data:any) => {
              if(data){
                  if(msg.talker()!=undefined){
                      const contact:(Contact|undefined) = msg.talker(); 
                      if(contact){
                        try {
                          const userKey:string = 'user:'+msg.text().split(' ')[1];
                          await contact.alias(userKey);
                        } catch (e) {
                          console.log(`failed to change ${contact.name()} alias!`)
                        }
                      }
                  }
              }
            }

循环打印的信息:

15:21:35 VERB PuppetCacheMixin __dirtyPayloadAwait(Contact<2>, @d2311b84195c9e7a3085c02304bc4a3e376a5f925cf2f27a5912597389df943b)
15:21:35 VERB PuppetCacheMixin dirtyPayload(Contact<2>, @d2311b84195c9e7a3085c02304bc4a3e376a5f925cf2f27a5912597389df943b)
15:21:35 VERB PuppetCacheMixin onDirty(Contact<2>, @d2311b84195c9e7a3085c02304bc4a3e376a5f925cf2f27a5912597389df943b)
15:21:35 VERB PuppetContactMixin contactPayloadDirty(@d2311b84195c9e7a3085c02304bc4a3e376a5f925cf2f27a5912597389df943b)

我使用的puppet是默认网页API的puppeteer,平台是macos本机运行 我翻阅了一些以前的issue,找到过一些类似的内容,但是还是有疑惑

huan commented 2 years ago

What's the out put of the following command?

npm ls wechaty
npm ls wechaty-puppet
npm ls wechaty-puppet-wechat
J1angX1n commented 2 years ago

What's the out put of the following command?

npm ls wechaty
npm ls wechaty-puppet
npm ls wechaty-puppet-wechat

out put of "npm ls wechaty":

wechaty-getting-started@1.10.1 /Users/mac/jx project/getting-started
└── wechaty@1.10.4

out put of "npm ls wechaty-puppet"

wechaty-getting-started@1.10.1 /Users/mac/jx project/getting-started
├─┬ wechaty-puppet-mock@1.10.2
│ └── wechaty-puppet@1.10.2
├─┬ wechaty-puppet-oicq@1.10.2
│ └── wechaty-puppet@1.10.2 deduped
├─┬ wechaty-puppet-wechat@1.10.4
│ └── wechaty-puppet@1.10.2 deduped
├─┬ wechaty-puppet-wechat4u@1.10.2
│ └── wechaty-puppet@1.10.2 deduped
├─┬ wechaty-puppet-whatsapp@1.10.4
│ └── wechaty-puppet@1.10.2 deduped
├─┬ wechaty-puppet-xp@1.10.2
│ └── wechaty-puppet@1.10.2 deduped
└─┬ wechaty@1.10.4
  ├─┬ wechaty-puppet-service@1.10.2
  │ ├── wechaty-puppet@1.10.2 deduped
  │ └─┬ wechaty-redux@1.10.2
  │   └── wechaty-puppet@1.10.2 deduped
  └── wechaty-puppet@1.10.2 deduped

out put of "npm ls wechaty-puppet-wechat"

wechaty-getting-started@1.10.1 /Users/mac/jx project/getting-started
└── wechaty-puppet-wechat@1.10.4
huan commented 2 years ago

Thank you very much for your information.

Could you please try the @next version to see if the problems still exist?

Update your dependencies by running:

npm i wechaty@next wechaty-puppet-wechat@next
J1angX1n commented 2 years ago

似乎还是不行,不知道是不是我的mac环境的问题,我一会把它搬到另一台linux电脑上试试

huan commented 2 years ago

Merge to

J1angX1n commented 2 years ago

我的情况和这位兄弟稍有不同,我这里也会不断地刷log但是似乎程序还是可以运行的,并没有卡死,我的log信息如下,log信息大致和他的差不多。 我刚才测试了一下只有在调用alias去修改备注的时候会出错,如果只是获取备注是没问题的,希望log信息对你有帮助 截屏2021-12-04 下午2.58.47.png