wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
317 stars 65 forks source link

无法通过微信号搜索好友 #235

Closed btcioner closed 4 years ago

btcioner commented 4 years ago

Important:Please file the issue follow the template, or we won't help you to solve the problem.

0. Report Issue Guide

  1. Please run the following command and check whether the problem has been fixed:
npm install wechaty-puppet-padlus@next
  1. Please search in the issue first, and make sure your problem had not been reported before

1. Versions

2. Describe the bug

我在实现bot.Friendship.search({weixin: 'xxxxxxx'}),提示这个方法不可用

3. To Reproduce

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

Steps to reproduce the behavior:

  1. run ' PADPLUS_REPLAY_MESSAGE=true BROLOG_LEVEL=silly ts-node index.ts'
  2. ...
  3. ...

4. Expected behavior

我拥有一个不是群里的人的微信号,但没有互加过好友,希望通过这个微信号,搜索并添加好友

5. Actual behavior

搜索接口先从本地缓存查找,然后又向后端搜索查找时候,直接服务关闭了

6. Full Output Logs

Set env WECHATY_LOG=silly in order to set log level to silly, then we can get the full log (If you dosen't set log env, log level is info as default, we cannot get the full log)

We need full log instead of log screenshot or log fragments!

Show Logs ```shell 11:11:26 SILL PadplusManager searchContact(xxxxxxx) 11:11:26 SILL PadplusManager No search-friend data in cache, need to request. 11:11:26 VERB PadplusContact searchContact(xxxxxxxxx) 11:11:26 SILL RequestClient request() 11:11:26 SILL DedupeApi dedupe() no need to dedupe api SEARCH_CONTACT. 11:11:26 SILL GRPC_GATEWAY GRPC Request ApiType: SEARCH_CONTACT 11:11:26 SILL GRPC_GATEWAY GRPC Request ApiType: SEARCH_CONTACT catch error. 11:11:28 SILL PadplusManager resetThrottleQueue.subscribe() reason: reconnect 11:11:28 SILL PadplusManager start() 11:11:28 SILL GRPC_GATEWAY init() 11:11:28 SILL GRPC_GATEWAY stop() 11:11:28 SILL GRPC_GATEWAY GRPC Request ApiType: CLOSE 11:11:28 SILL GRPC_GATEWAY GRPC Request ApiType: CLOSE catch error. 11:11:28 ERR Config ########################### 11:11:28 ERR Config unhandledRejection: Error: can not get callback result of SEARCH_CONTACT [object Promise] 11:11:28 ERR Config ########################### 11:11:28 ERR Config process.on(unhandledRejection) promise.catch(can not get callback result of SEARCH_CONTACT) Config Error: can not get callback result of SEARCH_CONTACT at PadplusContact. (/root/my-macpro-bot/node_modules/wechaty-puppet-padplus/src/padplus-manager/api-request/contact.ts:190:13) at Generator.next () at fulfilled (/root/my-macpro-bot/node_modules/wechaty-puppet-padplus/dist/src/padplus-manager/api-request/contact.js:5:58) (node:6869) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 5) 11:11:31 ERR Config ########################### 11:11:31 ERR Config unhandledRejection: Error: can not get callback result of SEARCH_CONTACT [object Promise] 11:11:31 ERR Config ########################### 11:11:31 ERR Config process.on(unhandledRejection) promise.catch(can not get callback result of SEARCH_CONTACT) Config Error: can not get callback result of SEARCH_CONTACT at PadplusContact. (/root/my-macpro-bot/node_modules/wechaty-puppet-padplus/src/padplus-manager/api-request/contact.ts:190:13) at Generator.next () at fulfilled (/root/my-macpro-bot/node_modules/wechaty-puppet-padplus/dist/src/padplus-manager/api-request/contact.js:5:58) (node:6869) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 6) ```

7. Additional context

Add any other context about the problem here.

[bug]

su-chang commented 4 years ago

If you want to add friend by WeChat account, you can have a try:

await bot.Friendship.add('xxxx')

bot.on('friendship', friendship => {
  // when he accepted your friendship request, you will get friendship confirm event here.
})

BTW, you must notice the frequency of the operation add friend.

Suggestion One account could add 20 ~ 30 friends one day.

btcioner commented 4 years ago

If you want to add friend by WeChat account, you can have a try:

await bot.Friendship.add('xxxx')

bot.on('friendship', friendship => {
  // when he accepted your friendship request, you will get friendship confirm event here.
})

BTW, you must notice the frequency of the operation add friend.

Suggestion One account could add 20 ~ 30 friends one day.

TSError: ⨯ Unable to compile TypeScript: index.ts:20:28 - error TS2345: Argument of type '"xxxxxxx"' is not assignable to parameter of type 'Contact'.

20 await bot.Friendship.add('xxxxxxxx', '这是xxxxx机器人的邀请')

su-chang commented 4 years ago

Sorry, it's my fault.

const contact = bot.Contact.load('xxx')
bot.Friendship.add(contact)

API DOC: https://wechaty.js.org/api

su-chang commented 4 years ago

@btcioner Anything update about this issue?