Closed btcioner closed 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.
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机器人的邀请')
Sorry, it's my fault.
const contact = bot.Contact.load('xxx')
bot.Friendship.add(contact)
API DOC: https://wechaty.js.org/api
@btcioner Anything update about this issue?
0. Report Issue Guide
1. Versions
What is your wechaty version? Answer: "wechaty": "^0.38.4",
What is your wechaty-puppet-padplus version? Answer: "wechaty-puppet-padplus": "^0.6.2"
What is your node version? (run
node --version
) Answer: v12.16.3What os are you using Answer:
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:
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.7. Additional context
Add any other context about the problem here.
[bug]