wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
629 stars 88 forks source link

bot.Friendship.add failed log : TypeError: this.friendshipSearchHandle is not a function #179

Open wzswzd opened 2 years ago

wzswzd commented 2 years ago

des: npm run demo

why bot.Friendship.search({ handle: "xxx"}) failed 
log err "this.friendshipSearchHandle is not a function" ??
but bot.Friendship.search({ phone: "123456"}) can work correctly

how to use it ?

phone :

12345678901 // real phone number

wxid :

wxid_xxxx // real wx account, could see from wechat

code1 :

let contactHandle = message.talker().handle();
const friend_handle = await bot.Friendship.search({ handle: `${contactHandle!}` });

code2 :

const friend_handle = await bot.Friendship.search({ handle:  "wxid_xxxx" });

code3 :

const friend_phone = await bot.Friendship.search({ phone:  "12345678901" });

log1 :

TypeError: this.friendshipSearchHandle is not a function
    at PuppetPadlocal.friendshipSearch (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty-puppet/src/mixins/friendship-mixin.ts:79:21)
    at Function.search (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/user-modules/friendship.ts:103:49)
    at WechatyImpl.<anonymous> (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/examples/demo.ts:162:52)
    at WechatyImpl.emit (node:events:527:28)
    at WechatyImpl.emit (node:domain:475:12)
    at WechatyImpl.emit (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/wechaty-mixins/gerror-mixin.ts:44:22)
    at PuppetPadlocal.<anonymous> (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/wechaty-mixins/puppet-mixin.ts:281:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

log2 :

TypeError: this.friendshipSearchHandle is not a function
    at PuppetPadlocal.friendshipSearch (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty-puppet/src/mixins/friendship-mixin.ts:79:21)
    at Function.search (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/user-modules/friendship.ts:103:49)
    at WechatyImpl.<anonymous> (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/examples/demo.ts:157:52)
    at WechatyImpl.emit (node:events:527:28)
    at WechatyImpl.emit (node:domain:475:12)
    at WechatyImpl.emit (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/wechaty-mixins/gerror-mixin.ts:44:22)
    at PuppetPadlocal.<anonymous> (file:///D:/Projects/WeChatTool/padlocalnew/puppet-padlocal/node_modules/wechaty/src/wechaty-mixins/puppet-mixin.ts:281:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

log3 :

no log, everything is all right