Git Product home page Git Product logo

puppet-padlocal's Introduction

WECHATY-PUPPET-PADLOCAL

NPM Version Powered by Wechaty Powered by padlocal-client-ts TypeScript Stage

WECHATY PUPPET NEW STAR

"New star from our community, which is the third most used Wechaty Puppet Provider now. Thank you very much @padlocal, for creating this WPP & WPS!"

— ⭐️ Wechaty The Trends in March 2021

TL;DR

  1. Get PadLocal TOKEN (with 7 days free trial): http://pad-local.com
  2. PadLocal on Wechaty official website: https://wechaty.js.org/docs/puppet-providers/padlocal/
  3. Getting Started with Wechaty: https://wechaty.js.org/docs/getting-started/

GETTING STARTED

REFERENCE

PUPPET COMPARISON

PadLocal is "one of" the most powerful puppet yet.

Puppet donut wxwork paimon padlocal👍
支持账号 个人微信 企业微信 个人微信 个人微信
<消息>
收发文本
收发个人名片
收发图文链接
发送图片、文件 ✅(较慢)
接收图片、文件
发送视频 ✅(较慢)
接收视频
发送小程序
接收动图
发送动图 ✅(以文件形式发送) ✅(以文件形式发送)
接收语音消息
发送语音消息
转发文本
转发图片
转发图文链接
转发音频
转发视频
转发文件
转发动图
转发小程序
<群组>
创建群聊
设置群公告
获取群公告
群二维码
拉人进群
踢人出群
退出群聊
改群名称
入群事件
离群事件
群名称变更事件
@群成员
群列表
群成员列表
群详情
<联系人>
修改备注
添加好友
自动通过好友
好友列表
好友详情
<其他>
登录事件
扫码状态
登出事件
主动退出登录
依赖协议 Windows Windows iPad iPad

Wechaty puppet compatibility

Author

@PadLocal

License

Apache-2.0

puppet-padlocal's People

Contributors

huan avatar padlocal avatar suhli avatar wyh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-padlocal's Issues

将群成员踢出群组报错

踢出群成员需要bot是群主或群管理员,但只发现获取当前群主信息的接口:Room.owner()。
所以当bot是群管理员或群众时,无法判断bot是否有踢人的权限。
建议加入一个获取群管理员的接口。

以下报错是当bot为群众时踢人引发的,但当手机端每次点进这个群时,总会再次报错

(node:62798) UnhandledPromiseRejectionWarning: VError: [tid:20ff7a43] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:20ff7a43] wechat bad request error
    at Request._failAllPendingRequest (/Users/colde/Develop/reviewer/node_modules/padlocal-client-ts/src/Request.ts:309:15)
    at ClientDuplexStreamImpl.<anonymous> (/Users/colde/Develop/reviewer/node_modules/padlocal-client-ts/src/Request.ts:72:12)
    at ClientDuplexStreamImpl.emit (events.js:314:20)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:486:12)
    at Object.onReceiveStatus (/Users/colde/Develop/reviewer/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/Users/colde/Develop/reviewer/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at /Users/colde/Develop/reviewer/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:62798) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:62798) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

发送文件下载一次后,后续再发送相同的文件,无法正常下载

日志

15:20:25 VERB Message say(FileBox#Url<rc-upload-1602042587168-16_1602090288510_3M.txt>)
15:20:51 VERB Message static load(7854934356697007990)
15:20:51 VERB Message constructor(7854934356697007990) for class WechatifiedMessage
15:20:51 VERB Message ready()
15:20:51 VERB Puppet messagePayload(7854934356697007990)
15:20:51 SILL Puppet messagePayloadCache(7854934356697007990) cache MISS
15:20:51 WARN [SchemaMapper] Error occurred while parse message attachment: TypeError: Cannot read property 'msg' of null
    at Object.appMessageParser (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message-appmsg.ts:89:74)
    at process._tickCallback (internal/process/next_tick.js:68:7)
15:20:51 SILL Puppet messagePayload(7854934356697007990) cache SET
15:20:51 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
15:20:51 SILL Contact ready() isReady() true
15:20:51 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="Soul001001"
15:20:51 SILL Contact ready() isReady() true
msg send file: {"domain":null,"_events":{},"_eventsCount":0,"id":"7854934356697007990","payload":{"id":"7854934356697007990","timestamp":1609140028,"type":1,"fromId":"wxid_8kg1wdu3jvk322","mentionIdList":[],"text":"","toId":"Soul001001"}}

参考图片

image

image

Cannot read property 'getContactIds' of undefined with matrix-appservice-wechaty

When I scan the QR code and login successfully. matrix-appservice-wechaty can receive messages, but It cannot send messages to WeChat user and get these errors.

wechaty_1  | 14:54:51 ERR PuppetServiceImpl grpcError() contactList() rejection: Cannot read property 'getContactIds' of undefined
wechaty_1  | {
wechaty_1  |   code: 13,
wechaty_1  |   details: "Cannot read property 'getContactIds' of undefined"
wechaty_1  | }

This is the docker-compose.yml

version: '2'
services:
  wechaty:
      image: wechaty/wechaty:next
      volumes:
        - ./config:/data
      networks:
        - default
      environment:
        - WECHATY_PUPPET_SERVER_PORT=7777
        - WECHATY_TOKEN={{random_token}}
        - WECHATY_PUPPET=wechaty-puppet-padlocal
        - WECHATY_PUPPET_PADLOCAL_TOKEN={{token}}
      ports:
        - 7777:7777
  matrix-appservice-wechaty:
      container_name: matrix-appservice-wechaty
      image: wechaty/matrix-appservice
      volumes:
        - ./config:/data
      networks:
        - default
      environment:
        - WECHATY_PUPPET_SERVICE_TOKEN=puppet_{{random_token}}
        - WECHATY_PUPPET_SERVICE_ENDPOINT={{hostip}}:7777
        - WECHATY_PUPPET=wechaty-puppet-service
#        - WECHATY_PUPPET=wechaty-puppet-puppeteer
        - WECHATY_LOG=silly
      command: ["--config", "/data/wechaty-config.yaml", "--file", "/data/wechaty-registration.yaml"]
      ports:
        - 8788:8788

contactPayload中type字段和friend字段不对

contactPayload中的type字段目前都是0 这个需要根据一下规则调整下。

  /**
   * Enum for ContactType
   * @enum {number}
   * @property {number} Unknown    - ContactType.Unknown    (0) for Unknown
   * @property {number} Personal   - ContactType.Personal   (1) for Personal
   * @property {number} Official   - ContactType.Official   (2) for Official
   */

  /**
   * Return the type of the Contact
   * > Tips: ContactType is enum here.</br>
   * @returns {ContactType.Unknown | ContactType.Personal | ContactType.Official}
   *
   * @example
   * const bot = new Wechaty()
   * await bot.start()
   * const isOfficial = contact.type() === bot.Contact.Type.Official
   */
  public type (): ContactType {
    if (!this.payload) {
      throw new Error('no payload')
    }
    return this.payload.type
  }

非好友的群成员的contactPayload的friend字段为true,这个应该改为false

Mac 下npm 无法install puppet-padlocal

npm install wechaty-puppet-padlocal@latest --registry=https://r.npm.taobao.org

[email protected] install /Users/Knight/Working/github/my-padlocal-bot/node_modules/better-sqlite3
prebuild-install || npm run build-release

prebuild-install WARN install No prebuilt binaries found (target=9.11.1 runtime=node arch=x64 libc= platform=darwin)

[email protected] build-release /Users/Knight/Working/github/my-padlocal-bot/node_modules/better-sqlite3
node-gyp rebuild --release

TOUCH deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3.intermediate
ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3.intermediate
TOUCH Release/obj.target/deps/locate_sqlite3.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
LIBTOOL-STATIC Release/sqlite3.a
CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
error: invalid value 'c++14' in '-std=c++14'
make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3.intermediate
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "/usr/local/Cellar/node/9.11.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/Knight/Working/github/my-padlocal-bot/node_modules/better-sqlite3
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: node-gyp rebuild --release
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Knight/.npm/_logs/2021-02-13T12_17_54_797Z-debug.log
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: prebuild-install || npm run build-release
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Knight/.npm/_logs/2021-02-13T12_17_55_468Z-debug.log

新注册微信不能登陆报“SERVER_ERROR: 2 UNKNOWN: [tid:bec7b588] wechat bad request erro”

新注册微信账户(1月28号注册)不能登陆。

export WECHATY_LOG="verbose"

export WECHATY_PUPPET="wechaty-puppet-padlocal"
export WECHATY_PUPPET_PADLOCAL_TOKEN="puppet_padlocal_XXXXX"

export WECHATY_PUPPET_SERVER_PORT="9001"
export WECHATY_TOKEN="1fe5f846-3cfb-401d-b20c-e03dd1974d9a"

docker run -ti \
  --name wechaty_puppet_service_token_gateway \
  --rm \
  -e WECHATY_LOG \
  -e WECHATY_PUPPET \
  -e WECHATY_PUPPET_PADLOCAL_TOKEN \
  -e WECHATY_PUPPET_SERVER_PORT \
  -e WECHATY_TOKEN \
  -p "$WECHATY_PUPPET_SERVER_PORT:$WECHATY_PUPPET_SERVER_PORT" \
  wechaty/wechaty:0.56

log:

15:04:29 VERB [Request] [tid:57199243] send event to server, seq:1, ack:undefined, type: 84, payload: {"longlinkid":"766ccd7667234765a957bc5c8355d9fb","payload":"F/EDArvd5+kUaoA6++dsCtti06vb8PCg4lCpXcA3QVUeikLcKyBsQbBjmhkmkH0r3yeMey+zBOTWqFuTXpe4QbV0984aqbjdB6usMirOlFy3IOrFQGFLQNt82X7oD5LtdWGTe3IIdkDudl07ePxgGX1/k0ayEf2fkj3UZzLT2Ti41BzwNrM7b671uP6A5sMWy9HP1CMTNNceBV03rnO3hZ8tF5asttAsDVxRnAO18V2cSv3pIReykU7mvxuPqZ/W+JLo1qL16uly4rqsupqE0OQYNRJXzoK+5RpJxwbL3BNyre6SUaLu6JDCV4XnPZ66O3XADYX9+AhWrVK2ts9pOO5VLODDBgs1nUvtk+pii/w+b5o7opvrS7jpyUpPJpPMp68HfnI1Rpz9OGF7zqbn7fzw8SSaHw6UkWOkvYaiFOUx77+Dexx4McU4JSJZwZyE/Nrre+CuJ2sKSMAyJqI6+vP+qWS7P5n6+1lyNo4CGxcVIU9sJ+5Xek37b61Qa7x+BFCl56NqUKGpKgxLJM34OzMchWjldioqLvDBJgJ/ONDxs42D9rDi+U0iJ7XzXq8PG9w8twu09x++MX+DU/ee8DpMsXNEjc/A26VH3IDSAiAUoyPOFEgg2HtbhKtxcqFzD443eQOv2sVtt6NTU+S+g72AilhxbeiPaJ8Fn0iJYjAS92lX86X5IKOIf1KksUgVQtR04AlvdIEIYI7KaXQasdTABZF8S7+MzJPGq5h9OTP1DFWLjIW8iwxabfekZha1CyfNPbBecc9gB7USUaOdZT0CpXKUGy2S1B7L/hmM4lJjpXGPzFit4VjMzV9/I9vwJUbr53LUkqGWClXCdkwiHc6YgdwKgJZlPAYfBF1MPn2Uh4sENyX3XUWW//M14EpxWXMCTGes8jMgigAWMslgcXqAjGXPkraeNl4uhwgTLHA="}
15:04:29 VERB [Request] [tid:57199243] receive event from server, seq:0 ack:1, type:85, payload:{"messageList":[{"type":0,"messageid":"c7bdcee3a2c44c1ab7607cd4fcb1e1cc"}]}
15:04:29 VERB [Request] [tid:bec7b588] send event to server, seq:undefined, ack:5, type: 11, payload: {"longlinkresponse":{}}
15:04:29 ERR [PuppetPadlocal] login failed: VError: [tid:bec7b588] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:bec7b588] wechat bad request error
    at Request._failAllPendingRequest (/wechaty/node_modules/padlocal-client-ts/src/Request.ts:334:15)
    at ClientDuplexStreamImpl.<anonymous> (/wechaty/node_modules/padlocal-client-ts/src/Request.ts:82:12)
    at ClientDuplexStreamImpl.emit (events.js:314:20)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:483:12)
    at Object.onReceiveStatus (/wechaty/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/wechaty/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
    at /wechaty/node_modules/@grpc/grpc-js/src/call-stream.ts:249:24
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
15:04:29 VERB StateSwitch <PuppetPadlocal> off(pending) <- (false)
15:04:29 VERB [LongLink] [766ccd7667234765a957bc5c8355d9fb] longlink shutdown
15:04:29 VERB [LongLink] [766ccd7667234765a957bc5c8355d9fb] longlink stopHeartbeat
15:04:29 VERB StateSwitch <PuppetPadlocal> off(true) <- (pending)
15:04:30 VERB StateSwitch <PuppetPadlocal> on(pending) <- (false)
15:04:30 VERB [Request] [tid:559eab84] send event to server, seq:1, ack:undefined, type: 200, payload: {"policy":1}
15:04:30 VERB [Request] [tid:559eab84] receive event from server, seq:1 ack:0, type:15, payload:{"longlinkupdateevent":{"longlinkhost":{"host":"long.weixin.qq.com","port":80},"reconnectimmediately":false}}

用注册时间比较长的微信可以登陆。
不知道该怎么调试。

on-room-leave 消息重复

bot是管理员的情况下,让bot移除群成员,会出现收到两次on-room-leave消息
不是管理员只会收到一次
image

No connection established

wechaty: 0.50.7
padlocal: 0.2.17
token: puppet_padlocal_0e50d75df43240exxxxxxxxxxxxxxx

20:52:45 VERB Wechaty wechatifyUserModules(Puppet#0<PuppetPadlocal>())
20:52:45 SILL StateSwitch <PuppetPadlocal> on() is false
20:52:45 SILL StateSwitch <PuppetPadlocal> on() is false
20:52:45 VERB StateSwitch <PuppetPadlocal> on(pending) <- (false)
{ Error: 14 UNAVAILABLE: No connection established
    at Object.callErrorFromStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call.ts:81:24)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:334:36)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:424:34)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24)
    at process._tickCallback (internal/process/next_tick.js:61:11)
  code: 14,
  details: 'No connection established',
  metadata: Metadata { internalRepr: Map {}, options: {} } }
20:52:46 ERR Wechaty start() exception: 14 UNAVAILABLE: No connection established
==========error==========
Error: 14 UNAVAILABLE: No connection established

error following step by step instructions

i got the following errors when following the step by step instruction. please advise. thank you!

npm install wechaty@latest --registry=https://r.npm.taobao.org

npm WARN deprecated [email protected]: Please consider upgrading to @sentry/node
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm ERR! code 1
npm ERR! path /Users/user/my-padlocal-bot/node_modules/grpc
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.7.4 found at "/usr/local/opt/python/bin/python3.7"
npm ERR! gyp info spawn /usr/local/opt/python/bin/python3.7
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/user/my-padlocal-bot/node_modules/grpc/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/user/Library/Caches/node-gyp/15.5.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/15.5.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/15.5.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/user/my-padlocal-bot/node_modules/grpc',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:376:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:284:12)
npm ERR! gyp ERR! System Darwin 20.2.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.5.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/user/my-padlocal-bot/node_modules/grpc
npm ERR! gyp ERR! node -v v15.5.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

Bot can not start

Error encountered after QRCode scanned (both when running demo and my own implement):

  • node version: 10.19.0
  • wechaty version: 0.48.10
  • padlocal version: 0.1.3
> [email protected] demo /Users/xxx/dev/padlocal-demo/wechaty-puppet-padlocal-demo
> ts-node main.ts

[Mon Nov 02 2020 20:42:13] [INFO]   20:42:13 INFO
      ============================================================
       Welcome to Wechaty PadLocal puppet!

       - wechaty-puppet-padlocal version: 0.1.3
       - padlocal-ts-client version: 0.1.25
      ============================================================

[Mon Nov 02 2020 20:42:13] [LOG]    TestBot started.
[Mon Nov 02 2020 20:42:15] [LOG]    TestBot onScan: Waiting(2) - https://api.qrserver.com/v1/create-qr-code/?data=http%3A%2F%2Fweixin.qq.com%2Fx%2Fg6FmnqtQkIcH2zo5A6WA
[Mon Nov 02 2020 20:42:52] [LOG]    TestBot onScan: Confirmed(4)
[Mon Nov 02 2020 20:42:53] [ERROR]  20:42:53 ERR [PuppetPadlocal] login failed
[Mon Nov 02 2020 20:42:53] [ERROR]  (node:63376) UnhandledPromiseRejectionWarning: Error: SubRequestCancelError: [tid:9317afa2] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:9317afa2] wechat bad request error
    at PuppetPadlocal.puppet.on.payload (/Users/xxx/dev/padlocal-demo/wechaty-puppet-padlocal-demo/node_modules/wechaty/src/wechaty.ts:440:32)
    at PuppetPadlocal.emit (events.js:198:13)
    at PuppetPadlocal.EventEmitter.emit (domain.js:448:20)
    at _client.api.login.then.catch (/Users/xxx/dev/padlocal-demo/wechaty-puppet-padlocal-demo/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:216:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[Mon Nov 02 2020 20:42:53] [ERROR]  (node:63376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
[Mon Nov 02 2020 20:42:53] [ERROR]  (node:63376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

发送mp3文件异常

15:05:19 VERB Message say(FileBox#Base64<test.mp3>)
15:05:19 ERR Config ###########################
15:05:19 ERR Config unhandledRejection: Error: voiceLength is required
    at checkRequiredField (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:9:11)
    at PadLocalClientApi.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:125:5)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:23:12)
    at PadLocalClientApi.sendVoiceMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:135:16)
    at PuppetPadlocal.messageSendFile (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:737:48)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
15:05:19 ERR Config ###########################
15:05:19 ERR Config process.on(unhandledRejection) promise.catch(voiceLength is required)
Config Error: voiceLength is required
    at checkRequiredField (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:9:11)
    at PadLocalClientApi.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClientApi.ts:125:5)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:23:12)
    at PadLocalClientApi.sendVoiceMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/PadLocalClientApi.js:135:16)
    at PuppetPadlocal.messageSendFile (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:737:48)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18068) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 5)

拉人入群出错

PadLocal版本: 0.2.3
代码: await room.add(from)
报错:
SubRequestCancelError: [tid:5260bdf9] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:5260bdf9] wechat bad request error

同样的代码 donut没有报错

私聊发送gif图片,有返回值,但是实际在手机端并没有收到。

14:59:31 VERB Message say(FileBox#Base64<small.gif>)
14:59:31 VERB Message static load(5520244318649141126)
14:59:31 VERB Message constructor(5520244318649141126) for class WechatifiedMessage
14:59:31 VERB Message ready()
14:59:31 VERB Puppet messagePayload(5520244318649141126)
14:59:31 SILL Puppet messagePayloadCache(5520244318649141126) cache MISS
14:59:31 SILL Puppet messagePayload(5520244318649141126) cache SET
14:59:31 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
14:59:31 SILL Contact ready() isReady() true
14:59:31 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="Soul001001"
14:59:31 SILL Contact ready() isReady() true
14:59:31 SILL Message toString() for message type: Image(6)
msg: Message#Image[🗣Contact<疫情小助手>]

发送大文件存在异常

14:57:17 VERB Message say(FileBox#File<file.pdf>)
14:57:19 ERR Config ###########################
14:57:19 ERR Config unhandledRejection: VError: [tid:d2ad28ed] request has been cancelled for reason: SERVER_ERROR: 1 CANCELLED: Call cancelled
    at Request._failAllPendingRequest (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:309:15)
    at ClientDuplexStreamImpl.Request._grpcStream.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:72:12)
    at ClientDuplexStreamImpl.emit (events.js:198:13)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:448:20)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24)
    at process._tickCallback (internal/process/next_tick.js:61:11) [object Promise]
14:57:19 ERR Config ###########################
14:57:19 ERR Config process.on(unhandledRejection) promise.catch([tid:d2ad28ed] request has been cancelled for reason: SERVER_ERROR: 1 CANCELLED: Call cancelled)
Config { VError: [tid:d2ad28ed] request has been cancelled for reason: SERVER_ERROR: 1 CANCELLED: Call cancelled
    at Request._failAllPendingRequest (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:309:15)
    at ClientDuplexStreamImpl.Request._grpcStream.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:72:12)
    at ClientDuplexStreamImpl.emit (events.js:198:13)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:448:20)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24)
    at process._tickCallback (internal/process/next_tick.js:61:11)
  jse_shortmsg:
   '[tid:d2ad28ed] request has been cancelled for reason: SERVER_ERROR',
  jse_cause:
   { Error: 1 CANCELLED: Call cancelled
       at Object.callErrorFromStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call.ts:81:24)
       at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:666:32)
       at Object.onReceiveStatus (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
       at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:243:24)
       at process._tickCallback (internal/process/next_tick.js:61:11)
     code: 1,
     details: 'Call cancelled',
     metadata: Metadata { internalRepr: Map {}, options: {} } },
  jse_info: {},
  message:
   '[tid:d2ad28ed] request has been cancelled for reason: SERVER_ERROR: 1 CANCELLED: Call cancelled',
  reason: 1 }
(node:17342) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)

show "login failed" message, but puppet still work

18:31:24 ERR [PuppetPadlocal] login failed
(node:82001) UnhandledPromiseRejectionWarning: Error: SubRequestCancelError: sub request has been cancelled reason: 1,
at PuppetPadlocal.puppet.on.payload (/Users//Downloads/*****_test/node_modules/wechaty/src/wechaty.ts:440:32)
at PuppetPadlocal.emit (events.js:198:13)
at PuppetPadlocal.EventEmitter.emit (domain.js:448:20)
at _client.api.login.then.catch (/Users/
/Downloads/*****_test/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:207:14)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:82001) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:82001) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
on message: Message#Recalled[🗣Contact<微信团队>]
on message: Message#Recalled[🗣Contact<微信团队>]
on message: Message#Recalled[🗣Contact<微信团队>]
on message: Message#Recalled[🗣Contact<微信团队>]

Update dependencies

There's some dependencies issue with Node.js v15 so I created PR #47

However, it seems that our codebase has some linting issues with the @chatie/eslint-config.

@padlocal would you like me to fix those problems for you so that we can run npm run lint successfully?

Node.js 14.15.4安装wechaty-puppet-padlocal@latest出错

gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at D:\Node.js\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "D:\Node.js\node.exe" "D:\Node.js\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\lorsque\node_modules\better-sqlite3
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: node-gyp rebuild --release
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

friendship.accept error

发送多次添加请求后再accept会报错

platform: MacOs 11.1
node version: v14.15.4
wechaty-puppet-padlocal version: 0.2.27
wechaty version:0.50.7

code:

this.wechaty
  .on('scan', this.onQrcode.bind(this))
  .on('login', this.login.bind(this))
  .on('friendship',  async friendship => {
      await friendship.accept();
      }
  })
  .on('message', this.onMessage.bind(this));

friendship:

{
  "contactId": "",
  "hello": "",
  "id": "6947782793190788413",
  "scene": 17,
  "stranger": "v3_020b3826fd03010000000000efba06f31dbb26000000501ea9a3dba12f95f6b60a0536a1adb6635afe82e6a7ba20ae16fc7cce3445374cd0e24ca31b1c64750107949a9464aad8519b76d162d6cb3ef5d80471b9708fb7a5afcc201052eedfeadb7ed1@stranger",
  "ticket": "v4_000b708f0b0400000100000000003e6b0a03294667fd018a56be04601000000050ded0b020927e3c97896a09d47e6e9efa2429a488ca691e44d40d88b305fec950a47a1447db389b12eaa2629b4f74d548b19a1aa759a347a94c7e0b500ea5053b339e1e151fddbab91a50ee7bd6d970811730c1ab0a5c038cdf4ebd7b5b4cf1c202d45b94e8e7c52920560b0a53184af614e2f17cfd6d56b39512ea745de0f390927dbb5f05e022a81d0c1783f97667007aa932979187e1345e0df3793bf630f367d2b57d71262adfebb038d22b9e8cfd05ed30ba9c6b88fdcd949b23a9ce42006ded950206f8dd387ec8062a4b5b896a795fe1c99a0ca477858713074e8f225beef0d77c65337b7fbce3a707a5b004824bddab66910aaade0eb47f783de6175b76d431a20c7e24cd@stranger",
  "timestamp": 1610923606,
  "type": 2
}

logs:

(node:51195) UnhandledPromiseRejectionWarning: VError: [tid:d2ac6544] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:d2ac6544] wechat bad request error
    at Request._failAllPendingRequest (/Users/shuhang/Document/repos/830AM-BE/node_modules/padlocal-client-ts/dist/Request.js:254:19)
    at ClientDuplexStreamImpl.<anonymous> (/Users/shuhang/Document/repos/830AM-BE/node_modules/padlocal-client-ts/dist/Request.js:55:18)
    at ClientDuplexStreamImpl.emit (events.js:315:20)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:485:12)
    at Object.onReceiveStatus (/Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/client.js:387:28)
    at Object.onReceiveStatus (/Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:297:181)
    at /Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/call-stream.js:130:78

自动登录报错

  • wechaty-puppet-padlocal version: 0.2.23
  • padlocal-ts-client version: 0.2.16

09:45:18 INFO [PuppetPadlocal] start login with type: AutoLogin
(node:81141) UnhandledPromiseRejectionWarning: Error: unsupported type: 35
    at Object.convertMessageType (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:22:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1139:12)
    at PuppetPadlocal.<anonymous> (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:81141) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:81141) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:81141) UnhandledPromiseRejectionWarning: Error: unsupported type: 35
    at Object.convertMessageType (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:22:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1139:12)
    at PuppetPadlocal.<anonymous> (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:81141) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:81141) UnhandledPromiseRejectionWarning: Error: unsupported type: 35
    at Object.convertMessageType (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:22:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1139:12)
    at PuppetPadlocal.<anonymous> (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:81141) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:81141) UnhandledPromiseRejectionWarning: Error: unsupported type: 35
    at Object.convertMessageType (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:22:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1139:12)
    at PuppetPadlocal.<anonymous> (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:81141) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:81141) UnhandledPromiseRejectionWarning: Error: unsupported type: 35
    at Object.convertMessageType (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:22:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1139:12)
    at PuppetPadlocal.<anonymous> (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/colde/Develop/reviewer/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:81141) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)```

公众号发来的消息类型有误 MessageType=13

MessageType=13 这个类型是撤回消息的类型 MessageType.Recalled

{"domain":null,"_events":{},"_eventsCount":0,"id":"1609855208","payload":{"id":"1609855208","timestamp":1609899194,"type":13,"fromId":"weixin","mentionIdList":[],"text":"<sysmsg type=\"functionmsg\">\n<functionmsg>\n<cgi>/cgi-bin/micromsg-bin/pullfunctionmsg</cgi>\n<cmdid>614</cmdid>\n<functionmsgid>MMKANYIKAN_JINGXUANREDDOT_1609855500</functionmsgid>\n<retryinterval>150</retryinterval>\n<retrycount>3</retrycount>\n<custombuff>YIqkAXIKMTYwOTg1NTUwMHoGd2VpeGluigEkTU1LQU5ZSUtBTl9KSU5HWFVBTlJFRERPVF8xNjA5ODU1NTAwqgFsZHMzYmtZbDJta1Q4VU9YVlplUHMzTjBYZFJlYnRiZkN2Ump5bUFHSGx6N3IwRXdrQnBkWE1OZ0YyYVdCbjJTSzNJQUxHNnlWYW1LcktnNUZ0ekI4Z2VLajF3c3ZTWjZuNUJFRXlHdmhnWTg9</custombuff>\n<businessid>21002</businessid>\n<actiontime>1609855208</actiontime>\n<functionmsgversion>2</functionmsgversion>\n</functionmsg>\n</sysmsg>","toId":"wxid_q0yib0cg8b2s22"}}, message type: 13

目前不支持自动通过群邀请

16:54:08 VERB RoomInvitation accept()
16:54:08 ERR Config ###########################
16:54:08 ERR Config unhandledRejection: Error: Accept room invitation is not unsupported
    at PuppetPadlocal.roomInvitationAccept (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1061:11)
    at WechatifiedRoomInvitation.accept (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/user/room-invitation.ts:123:31)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:165:26
    at step (/Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:32:23)
    at Object.next (/Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:13:53)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:3:12)
    at Wechaty.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/index.ts:163:48)
    at Wechaty.emit (events.js:198:13)
    at Wechaty.EventEmitter.emit (domain.js:448:20)
    at PuppetPadlocal.puppet.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/wechaty.ts:506:18)
    at PuppetPadlocal.emit (events.js:198:13)
    at PuppetPadlocal.EventEmitter.emit (domain.js:448:20)
    at PuppetPadlocal._onPushMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1300:14)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]

exception when trying to add a Contact into a tag.

copied from this wechaty/wechaty#2140

while trying to use the sdk of add in tag.ts

await tag.add(contact);

I got below exception, is this expected server error?? So Tecent does not allow this API? Or I miss something?

00:12:59 ERR Tag add() exception: [tid:d8a97571] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:d8a97571] wechat bad request error
(node:46652) UnhandledPromiseRejectionWarning: Error: add error : SubRequestCancelError: [tid:d8a97571] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:d8a97571] wechat bad request error
at WechatifiedTag.add (/Users/Knight/Working/github/padlocal-tagbased-bot/node_modules/wechaty/src/user/tag.ts:182:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:46652) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:46652) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Maybe padlocal does not support this? Could we need to support this feature?

PadLocal问题清单

Bug List

严重

  • 接收到二维码后,持续一段时间没有扫码登录,会有报错提示,且不再推送新的二维码 #12
  • 发送大文件存在异常 #13
  • 私聊发送gif图片,有返回值,但是实际在手机端并没有收到。 #15
  • 发送mp3文件异常 #16
  • 发送@某人的消息没有对应的mention提示 #17
  • 发送文件下载一次后,后续再发送相同的文件,无法正常下载 #18
  • 调用退出登录接口后异常 #20
  • 无法接收到企业微信的私聊消息 #24
  • 漏发消息 #27
  • 手机端退出iPad微信登录后,接收到的reason是个对象,且没有新的二维码推送 #30

一般

  • 发送小程序标题与构造对象中的标题不符 #19
  • 登录之前已登录过的微信号,仍有二维码【Waiting】状态的推送,是否应该是直接跳过该状态? #21
  • room-topic事件中没有oldTopic字段 #22
  • bot非群主情况下,群成员被移出群聊或退群,没有对应的事件,但是有群成员变动的通知。 #23
  • 无法获取到企业微信群的群头像 #25
  • 需要将接收到群公告中的mentionList 从 ["announcement@all"] 转换为具体的memberIdList #26
  • 目前不支持自动通过群邀请 #28
  • 企业微信添加bot的好友请求无法转换为对应的friendship事件 #29

How to send a MiniProgram?

Construct a MiniProgram with params like this:

// params are just for example 
const msg = new wechaty.MiniProgram({
  appid: 'foo_appid',
  username: 'foo_name@app',
  title: 'foo_title',
  description: 'blabla',
  pagePath: 'foo_path',
  iconUrl: 'foo_icon',
  thumbUrl: 'foo_url',
  thumbKey: 'foo_key',
});

Error occured when trying send the msg:

Error: originalMessageToUserName is required

Then I looked into the codes:

https://github.com/padlocal/wechaty-puppet-padlocal/blob/5608567a6c8b75839a90f50d61768b06e7391042/src/puppet-padlocal.ts#L797-L802

and in PadLocalClientApi#getEncryptedFile, there was a check for params:

  checkRequiredField(originalMessageToUserName, "originalMessageToUserName");

Obviously, the given value "" for originalMessageToUserName which could not pass the validation caused the error 💡.

I changed the value of originalMessageToUserName to the bot's wechat id manually(is that right? what is originalMessageToUserName?), and sent the msg again...

It worked 🎉! MiniProgram was sent and received successfully.

But another error printed:

Error: can not find message in cache for messageId: xxxxx

😓

So, what is the way to send a MiniProgram correctly?

无法获取到企业微信群的群头像

16:45:39 VERB Room avatar()
16:45:39 ERR Config ###########################
16:45:39 ERR Config unhandledRejection: TypeError [ERR_INVALID_URL]: Invalid URL:
    at onParseError (internal/url.js:241:17)
    at new URL (internal/url.js:319:5)
    at Function.fromUrl (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/file-box/src/file-box.ts:69:25)
    at PuppetPadlocal.roomAvatar (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1007:20)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
16:45:39 ERR Config ###########################
16:45:39 ERR Config process.on(unhandledRejection) promise.catch(Invalid URL: )
Config { TypeError [ERR_INVALID_URL]: Invalid URL:
    at onParseError (internal/url.js:241:17)
    at new URL (internal/url.js:319:5)
    at Function.fromUrl (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/file-box/src/file-box.ts:69:25)
    at PuppetPadlocal.roomAvatar (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1007:20)
    at process._tickCallback (internal/process/next_tick.js:68:7) input: '' }
(node:20628) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)

企业微信添加bot的好友请求无法转换为对应的friendship事件

17:00:14 VERB [PuppetPadlocal] on push original message: {"id":"1781282098155551803","type":65,"createtime":1609146014,"fromusername":"fmessage","tousername":"wxid_8kg1wdu3jvk322","content":"<msg fromusername=\"25984985460320147@openim\" fromnickname=\"是不是改个名\" content=\"我是句子科技的是不是改个名,添加我的企业微信与我联系吧。\" fullpy=\"shibushigaigeming\" shortpy=\"SBSGGM\" imagestatus=\"4\" bigheadimgurl=\"http://wework.qpic.cn/bizmail/YtDta1u3BCtIicnAsEOYJrYkScJpGFo09udzBRwJic7sWlJcjs7tJhAw/0\" smallheadimgurl=\"http://wework.qpic.cn/bizmail/YtDta1u3BCtIicnAsEOYJrYkScJpGFo09udzBRwJic7sWlJcjs7tJhAw/0\" ticket=\"v1_f68005637f475fe4a877dfb13b0010d59cb1674b8ed593b4103db7f37a7f2b2f76f831f3df22c83509c80d19e4103d9477a5cca59974668f65916bcd4aa1a2207f8681242dd51f20a2a909f4b27065f605480e95d835abb1d25a2b2744caf17c6df5a23e7601ea4017a3f169082941ee72ef2a702ae741d637362dd801138e4cfe22a4de8bf33d2ca08a332a9455c5815af3fefd604041b14d0c24447992360fa426c409f7d0f851cff1fc5864ff2e352997658bcbeb0c8fb33f5df9c6616be25bc4292d44359355e474f6036bea368a\" opcode=\"2\" openimappid=\"3552365301\" scene=\"30\" sourceusername=\"\" sourcenickname=\"\" />\n","pushcontent":"","binarypayload":"","atList":[]}
17:00:14 VERB [PuppetPadlocal] 0a13313738313238323039383135353535313830331041189ebda6ff052208666d6573736167652a13777869645f386b6731776475336a766b33323232c1073c6d73672066726f6d757365726e616d653d223235393834393835343630333230313437406f70656e696d222066726f6d6e69636b6e616d653d22e698afe4b88de698afe694b9e4b8aae5908d2220636f6e74656e743d22e68891e698afe58fa5e5ad90e7a791e68a80e79a84e698afe4b88de698afe694b9e4b8aae5908defbc8ce6b7bbe58aa0e68891e79a84e4bc81e4b89ae5beaee4bfa1e4b88ee68891e88194e7b3bbe590a7e38082222066756c6c70793d22736869627573686967616967656d696e67222073686f727470793d2253425347474d2220696d6167657374617475733d2234222062696768656164696d6775726c3d22687474703a2f2f7765776f726b2e717069632e636e2f62697a6d61696c2f59744474613175334243744969636e4173454f594a72596b53634a7047466f303975647a4252774a69633773576c4a636a7337744a6841772f302220736d616c6c68656164696d6775726c3d22687474703a2f2f7765776f726b2e717069632e636e2f62697a6d61696c2f59744474613175334243744969636e4173454f594a72596b53634a7047466f303975647a4252774a69633773576c4a636a7337744a6841772f3022207469636b65743d2276315f663638303035363337663437356665346138373764666231336230303130643539636231363734623865643539336234313033646237663337613766326232663736663833316633646632326338333530396338306431396534313033643934373761356363613539393734363638663635393136626364346161316132323037663836383132343264643531663230613261393039663462323730363566363035343830653935643833356162623164323561326232373434636166313763366466356132336537363031656134303137613366313639303832393431656537326566326137303261653734316436333733363264643830313133386534636665323261346465386266333364326361303861333332613934353563353831356166336665666436303430343162313464306332343434373939323336306661343236633430396637643066383531636666316663353836346666326533353239393736353862636265623063386662333366356466396336363136626532356263343239326434343335393335356534373466363033366265613336386122206f70636f64653d223222206f70656e696d61707069643d223335353233363533303122207363656e653d2233302220736f75726365757365726e616d653d222220736f757263656e69636b6e616d653d2222202f3e0a
17:00:14 VERB Message static load(1781282098155551803)
17:00:14 VERB Message constructor(1781282098155551803) for class WechatifiedMessage
17:00:14 VERB Message ready()
17:00:14 VERB Puppet messagePayload(1781282098155551803)
17:00:14 SILL Puppet messagePayloadCache(1781282098155551803) cache MISS
17:00:14 ERR Config ###########################
17:00:14 ERR Config unhandledRejection: Error: unsupported type: 65
    at Object.convertMessageType (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:20:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1098:12)
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
17:00:14 ERR Config ###########################
17:00:14 ERR Config process.on(unhandledRejection) promise.catch(unsupported type: 65)
Config Error: unsupported type: 65
    at Object.convertMessageType (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/message-parser/helpers/message.ts:57:13)
    at Object.padLocalMessageToWechaty (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:20:16)
    at PuppetPadlocal.messageRawPayloadParser (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1098:12)
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:20824) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 4)

接收到二维码后,持续一段时间没有扫码登录,会有报错提示,且不再推送新的二维码

猜测是二维码过期后,触发了某些异常。

14:45:44 VERB [PuppetPadlocal] start login with type: QrLogin
14:45:44 VERB [PuppetPadlocal] scan event, status: Waiting, with qrcode: http://weixin.qq.com/x/obOru2-YjAKRI_JRS_OL

    ============================================
    qrcode : http://weixin.qq.com/x/obOru2-YjAKRI_JRS_OL, status: 2
    ============================================
14:50:34 ERR [PuppetPadlocal] login failed
==========error==========
Error: SubRequestCancelError: [tid:77dd522d] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:77dd522d] wechat request io error
14:50:34 SILL StateSwitch <PuppetPadlocal> off() is false
14:50:34 SILL StateSwitch <PuppetPadlocal> off() is false
14:50:34 VERB StateSwitch <PuppetPadlocal> off(pending) <- (false)
14:50:34 ERR Config ###########################
14:50:34 ERR Config unhandledRejection: TypeError: Cannot read property 'close' of undefined
    at PuppetPadlocal.stop (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:264:27)
    at _client.api.login.then.catch (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:227:20)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
14:50:34 ERR Config ###########################
14:50:34 ERR Config process.on(unhandledRejection) promise.catch(Cannot read property 'close' of undefined)
Config TypeError: Cannot read property 'close' of undefined
    at PuppetPadlocal.stop (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:264:27)
    at _client.api.login.then.catch (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:227:20)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:17737) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)

登录之前已登录过的微信号,仍有二维码【Waiting】状态的推送,是否应该是直接跳过该状态?

16:03:42 VERB [PuppetPadlocal] start login with type: OneClickLogin
16:03:43 VERB [PuppetPadlocal] scan event, status: Waiting

    ============================================
    qrcode : , status: 2
    ============================================

16:03:44 VERB [PuppetPadlocal] scan event, status: Scanned

    ============================================
    qrcode : , status: 3
    ============================================

16:03:46 VERB [PuppetPadlocal] scan event, status: Confirmed

    ============================================
    qrcode : , status: 4
    ============================================

16:03:47 VERB [PuppetPadlocal] login success: wxid_8kg1wdu3jvk322

无法接收到企业微信的私聊消息

16:38:27 VERB [PuppetPadlocal] on push original message: {"id":"1987309256459628338","type":1,"createtime":1609144707,"fromusername":"25984982132676060@openim","tousername":"wxid_8kg1wdu3jvk322","content":"#ding","pushcontent":"苏畅 : #ding","binarypayload":"","atList":[]}
16:38:27 VERB [PuppetPadlocal] 0a133139383733303932353634353936323833333810011883b3a6ff0522183235393834393832313332363736303630406f70656e696d2a13777869645f386b6731776475336a766b33323232052364696e673a0ee88b8fe79585203a202364696e67
16:38:27 VERB Message static load(1987309256459628338)
16:38:27 VERB Message constructor(1987309256459628338) for class WechatifiedMessage
16:38:27 VERB Message ready()
16:38:27 VERB Puppet messagePayload(1987309256459628338)
16:38:27 SILL Puppet messagePayloadCache(1987309256459628338) cache MISS
16:38:27 ERR Config ###########################
16:38:27 ERR Config unhandledRejection: Error: empty roomId and empty fromId!
    at Object.padLocalMessageToWechaty (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:95:11)
    at PuppetPadlocal.messageRawPayloadParser (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1098:12)
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
16:38:27 ERR Config ###########################
16:38:27 ERR Config process.on(unhandledRejection) promise.catch(empty roomId and empty fromId!)
Config Error: empty roomId and empty fromId!
    at Object.padLocalMessageToWechaty (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/padlocal/schema-mapper/index.ts:95:11)
    at PuppetPadlocal.messageRawPayloadParser (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1098:12)
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:855:35)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:5:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:19663) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 16)

先下载后转发图片/文件/小程序,可以转发成功,但有异常报错提示

加载到的msgId与实际接收消息的msgId不符

14:38:35 VERB Message forward(Contact<苏畅>)
14:38:35 VERB Message static load(641510417)
14:38:35 VERB Message constructor(641510417) for class WechatifiedMessage
14:38:35 VERB Message ready()
14:38:35 VERB Puppet messagePayload(641510417)
14:38:35 SILL Puppet messagePayloadCache(641510417) cache MISS
14:38:35 ERR Message forward(Contact<苏畅>) exception: Error: can not find message in cache for messageId: 641510417
14:38:35 ERR Config ###########################
14:38:35 ERR Config unhandledRejection: Error: can not find message in cache for messageId: 641510417
    at PuppetPadlocal.messageRawPayload (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1141:13)
    at process._tickCallback (internal/process/next_tick.js:68:7) [object Promise]
14:38:35 ERR Config ###########################
14:38:35 ERR Config process.on(unhandledRejection) promise.catch(can not find message in cache for messageId: 641510417)
Config Error: can not find message in cache for messageId: 641510417
    at PuppetPadlocal.messageRawPayload (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1141:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:402) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 4)

撤回消息中的fromId和toId存在逻辑问题

fromId 主动撤回消息账号的ID

toId 接收撤回消息通知账号的ID

text 字段中需要存放已撤回消息的ID,即xml中的newmsgid,便于查找已撤回的消息内容

你可以参考以下代码:

const recalledPayload = await recalledPayloadParser(rawPayload)
const pattern = [
  /"(.+)" 撤回了一条消息/,
  /"(.+)" has recalled a message./,
]
const patternSelf = [
  /你撤回了一条消息/,
  /You recalled a message/,
]
if (recalledPayload) {
  const isRecalled = pattern.some(regex => regex.test(recalledPayload.replaceMsg))
  const isRecalledSelf = patternSelf.some(regex => regex.test(recalledPayload.replaceMsg))
  if (isRecalled || isRecalledSelf) {
    text = recalledPayload.newMsgId
    if (isRecalledSelf) {
      fromId = rawPayload.from_wxid
      if (isRoomId(rawPayload.to_wxid)) {
        roomId = rawPayload.to_wxid
      } else if (isContactId(rawPayload.to_wxid)) {
        toId = rawPayload.to_wxid
      }
    }
  } else {
    payloadBase.type = MessageType.Unknown
  }
} else {
  payloadBase.type = MessageType.Unknown
}

The application will crash while sending pictures

environment

  • windows 10
  • nodejs: 12.18.4 (Currently using 64-bit executable)
  • wechaty-puppet-padlocal version: 0.1.3
  • padlocal-ts-client version: 0.1.25

code

bot.on("message", async (msg: Message) => {
                const contact = msg.from()
                let text = msg.text()
                if (contact) {
                    const id = await contact!.id
                    console.log(`contact: ${id} Text: ${text}`)
                    await contact!.say('hello');
                    const fileBox = FileBox.fromFile('E:/coding/react/spidey/spidey-express/images/electron.png');
                    if (fileBox) {
                        await contact!.say(fileBox)
                    }
                }
            })

details

No matter what the local image file,it will crash if the bot send image frequently or sometimes.

error message

[Mon Nov 09 2020 20:47:35] [WARN] socket on error: IOError: socket is read-write timeout
......
[Mon Nov 09 2020 20:49:35] [ERROR] (node:36936) UnhandledPromiseRejectionWarning: VError: [tid:eaf4f6b4] Fail to send socket to:"113.96.230.45:80", data:ab00003126271082e.......

log download link

调用退出登录接口后异常

15:59:49 VERB [CacheManager] close()
15:59:49 SILL [CacheManager] close() closing caches ...
==========logout success==========
reason : logout by self
15:59:49 SILL [CacheManager] close() cache closed.
15:59:49 SILL StateSwitch <PuppetPadlocal> off() is pending
15:59:49 VERB StateSwitch <PuppetPadlocal> off(true) <- (pending)
15:59:50 SILL Contact constructor(undefined)
15:59:50 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="undefined"
15:59:50 SILL StateSwitch <PuppetPadlocal> off() is true
15:59:50 WARN [PuppetPadlocal] stop() is called on a OFF puppet. await ready(off) and return.
15:59:50 VERB StateSwitch <PuppetPadlocal> ready(off, false)
15:59:50 SILL StateSwitch <PuppetPadlocal> ready(off, false) resolved.
15:59:50 VERB Contact ready() this.wechaty.puppet.contactPayload(undefined) exception: no id
15:59:50 ERR Config ###########################
15:59:50 ERR Config unhandledRejection: Error: no id
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:684:13)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:4:12)
    at PuppetPadlocal.contactPayload (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:458:16)
    at WechatifiedContactSelf.ready (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/user/contact.ts:829:48)
    at PuppetPadlocal.puppet.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/wechaty.ts:474:27)
    at PuppetPadlocal.emit (events.js:198:13)
    at PuppetPadlocal.EventEmitter.emit (domain.js:448:20)
    at PadLocalClient._client.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1337:12)
    at PadLocalClient.emit (events.js:198:13)
    at PadLocalClient.EventEmitter.emit (domain.js:448:20)
    at PadLocalClient.emit (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClient.ts:28:18)
    at Request.ret.onSystemEventCallback (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClient.ts:98:14)
    at Request.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:217:35)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:4:12)
    at Request._onServerMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:139:16)
    at ClientDuplexStreamImpl.Request._grpcStream.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:55:12)
    at ClientDuplexStreamImpl.emit (events.js:198:13)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:448:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at ClientDuplexStreamImpl.Readable.push (_stream_readable.js:224:10)
    at Object.onReceiveMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:657:16)
    at Object.onReceiveMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:373:49)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:313:22)
    at process._tickCallback (internal/process/next_tick.js:61:11) [object Promise]
15:59:50 ERR Config ###########################
15:59:50 ERR Config process.on(unhandledRejection) promise.catch(no id)
Config Error: no id
    at PuppetPadlocal.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/src/puppet.ts:684:13)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:4:12)
    at PuppetPadlocal.contactPayload (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet/dist/src/puppet.js:458:16)
    at WechatifiedContactSelf.ready (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/user/contact.ts:829:48)
    at PuppetPadlocal.puppet.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty/src/wechaty.ts:474:27)
    at PuppetPadlocal.emit (events.js:198:13)
    at PuppetPadlocal.EventEmitter.emit (domain.js:448:20)
    at PadLocalClient._client.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:1337:12)
    at PadLocalClient.emit (events.js:198:13)
    at PadLocalClient.EventEmitter.emit (domain.js:448:20)
    at PadLocalClient.emit (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClient.ts:28:18)
    at Request.ret.onSystemEventCallback (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/PadLocalClient.ts:98:14)
    at Request.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:217:35)
    at Generator.next (<anonymous>)
    at /Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:4:12)
    at Request._onServerMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/dist/Request.js:139:16)
    at ClientDuplexStreamImpl.Request._grpcStream.on (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/padlocal-client-ts/src/Request.ts:55:12)
    at ClientDuplexStreamImpl.emit (events.js:198:13)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:448:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at ClientDuplexStreamImpl.Readable.push (_stream_readable.js:224:10)
    at Object.onReceiveMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client.ts:657:16)
    at Object.onReceiveMessage (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/client-interceptors.ts:373:49)
    at process.nextTick (/Users/suchang/Desktop/PROJECT/Test/testPuppet/node_modules/@grpc/grpc-js/src/call-stream.ts:313:22)
    at process._tickCallback (internal/process/next_tick.js:61:11)
(node:19184) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 3)

Can't Login - Wechat Request IO error

After scanning the QR code, login confirmed, this error shows up.

Error message:
(node:7775) UnhandledPromiseRejectionWarning: VError: [tid:d195bacb] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:d195bacb] wechat request io error
at Request._failAllPendingRequest (/home/bitnami/optionbot/node_modules/padlocal-client-ts/dist/Request.js:262:19)
at ClientDuplexStreamImpl. (/home/bitnami/optionbot/node_modules/padlocal-client-ts/dist/Request.js:56:18)
at ClientDuplexStreamImpl.emit (events.js:315:20)
at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:467:12)
at Object.onReceiveStatus (/home/bitnami/optionbot/node_modules/@grpc/grpc-js/build/src/client.js:387:28)
at Object.onReceiveStatus (/home/bitnami/optionbot/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /home/bitnami/optionbot/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
at processTicksAndRejections (internal/process/task_queues.js:75:11)
(Use node --trace-warnings ... to show where the warning was created)

Quoted text message type error: Unknown

Same issue as reported in juzibot/donut-tester#78

When the bot received a quoted message, the message type is Text before, and it seems changed to be Unknown now.

This is a breaking change for our Friday.BOT because it can not forward quoted messages in rooms because of this change.

Can't switch Account

  • What I do
    • Start Ding-dong Bot.
    • Scan QRcode with first Wechat accout.
    • Successfully Login.
    • Logout.
    • Scan with Another Wechat account.
    • Error happens.
    • Scan with First Acoount
    • Success.
    • Scan with Second Account
    • Fail with Same Error.
    • (BTW, the second Wechat account is newly created, i dont know if this is the issue).
  • Error Message:
02:27:10 INFO StarterBot onScan: Waiting(2) - https://api.qrserver.com/v1/create-qr-code/?data=http%3A%2F%2Fweixin.qq.com%2Fx%2FQeegtG06MNd1Ukh3NTMM
02:27:19 INFO StarterBot onScan: Scanned(3)
02:27:19 INFO StarterBot onScan: Confirmed(4)
02:27:24 ERR [PuppetPadlocal] login failed: VError: [tid:9447ec8d] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:9447ec8d] wechat bad request error
    at Request._failAllPendingRequest (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/padlocal-client-ts/src/Request.ts:334:15)
    at ClientDuplexStreamImpl.<anonymous> (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/padlocal-client-ts/src/Request.ts:82:12)
    at ClientDuplexStreamImpl.emit (events.js:314:20)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:486:12)
    at Object.onReceiveStatus (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/client.ts:666:18)
    at Object.onReceiveStatus (/Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/client-interceptors.ts:387:48)
    at /Users/jelly/workspace/rw-helper-back/wechat-bot/node_modules/@grpc/grpc-js/src/call-stream.ts:249:24
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
  • Ding-Dong bot Code:
import { PuppetPadlocal } from "wechaty-puppet-padlocal";
import { Contact, Message, ScanStatus, Wechaty, log } from "wechaty";
import { generate } from "qrcode-terminal";

require("dotenv").config();
const puppet = new PuppetPadlocal({});

const bot = new Wechaty({
  name: "TestBot",
  puppet,
});

bot
  .on("scan", (qrcode: string, status: ScanStatus) => {
    if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
      generate(qrcode, { small: true }); // show qrcode on console

      const qrcodeImageUrl = [
        //"https://wechaty.js.org/qrcode/",
        "https://api.qrserver.com/v1/create-qr-code/?data=",
        encodeURIComponent(qrcode),
      ].join("");
    
      log.info(
        "StarterBot",
        "onScan: %s(%s) - %s",
        ScanStatus[status],
        status,
        qrcodeImageUrl
      );
    } else {
      log.info("StarterBot", "onScan: %s(%s)", ScanStatus[status], status);
    }

  })

  .on("login", (user: Contact) => {
    console.log(`${user} login`);
  })

  .on("logout", (user: Contact) => {
    console.log(`${user} logout`);
  })

  .on("message", async (message: Message) => {
    console.log(`on message: ${message.toString()}`);
    if (message.text() === "ding") {
      await message.say("dong");
    }
    if (message.text() === "esc") {
      await bot.logout();
    }
  })

  .start();

console.log("TestBot", "started");

Thanks for your help.

Install OSS.Chat for issue notification in WeChat rooms

As our Wechaty developers' room will receive issues & comments from the community repos, I'd like to add wechaty-puppet-padlocal so that we can receive issues in this repo too.

Would you like to support this community feature? If you would like to, please install OSS.Chat GitHub Apps from https://github.com/apps/osschat to this repo, then I'll be able to set it up through https://github.com/kaiyuanshe/osschat/blob/master/src/projects/wechaty.ts.

.memory-card.json

我没有发现xxx.memory-card.json的位置,是在哪里或者那种方式存储的?

漏发消息

调用四次发送文本的请求,实际只发送了2条消息

16:49:51 SILL Contact ready() isReady() true

      ============================================
      on message : {"domain":null,"_events":{},"_eventsCount":0,"id":"6192376592442397824","payload":{"id":"6192376592442397824","timestamp":1609145390,"type":7,"fromId":"Soul001001","mentionIdList":[],"roomId":"23123308191@chatroom","text":"@me","toId":"wxid_8kg1wdu3jvk322"}}, message type: 7
      text: @me
      from: Contact<alias709>
      room: Room<企业微信测试群 padlocal>
      ============================================

16:49:51 VERB Puppet selfId()
16:49:51 VERB Message mentionList()
16:49:51 VERB UrlLink constructor()
16:49:51 SILL Room memberAll()
16:49:51 VERB Room memberList()
16:49:51 VERB Room say(test @ 1, Contact<alias709>)
16:49:51 VERB Puppet roomMemberPayload(roomId=23123308191@chatroom, memberId=Soul001001)
16:49:51 SILL Puppet roomMemberPayload(23123308191@chatroom) cache SET
16:49:51 VERB Message static load(8257408989962072531)
16:49:51 VERB Message constructor(8257408989962072531) for class WechatifiedMessage
16:49:51 VERB Message ready()
16:49:51 VERB Puppet messagePayload(8257408989962072531)
16:49:51 SILL Puppet messagePayloadCache(8257408989962072531) cache MISS
16:49:51 SILL Puppet messagePayload(8257408989962072531) cache SET
16:49:51 VERB Room ready()
16:49:51 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
16:49:51 SILL Contact ready() isReady() true
16:49:51 VERB Room say(test @  2, Contact<alias709>)
16:49:51 VERB Puppet roomMemberPayload(roomId=23123308191@chatroom, memberId=Soul001001)
16:49:51 VERB Message static load(4686408594582539556)
16:49:51 VERB Message constructor(4686408594582539556) for class WechatifiedMessage
16:49:51 VERB Message ready()
16:49:51 VERB Puppet messagePayload(4686408594582539556)
16:49:51 SILL Puppet messagePayloadCache(4686408594582539556) cache MISS
16:49:51 SILL Puppet messagePayload(4686408594582539556) cache SET
16:49:51 VERB Room ready()
16:49:51 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
16:49:51 SILL Contact ready() isReady() true
16:49:51 VERB Room say(test @  3, Contact<alias709>)
16:49:51 VERB Puppet roomMemberPayload(roomId=23123308191@chatroom, memberId=Soul001001)
16:49:51 VERB Message static load(2551998182180169202)
16:49:51 VERB Message constructor(2551998182180169202) for class WechatifiedMessage
16:49:51 VERB Message ready()
16:49:51 VERB Puppet messagePayload(2551998182180169202)
16:49:51 SILL Puppet messagePayloadCache(2551998182180169202) cache MISS
16:49:51 SILL Puppet messagePayload(2551998182180169202) cache SET
16:49:51 VERB Room ready()
16:49:51 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
16:49:51 SILL Contact ready() isReady() true
16:49:51 VERB Room say(test @   4, Contact<alias709>)
16:49:51 VERB Puppet roomMemberPayload(roomId=23123308191@chatroom, memberId=Soul001001)
16:49:52 VERB Message static load(4471187810177254022)
16:49:52 VERB Message constructor(4471187810177254022) for class WechatifiedMessage
16:49:52 VERB Message ready()
16:49:52 VERB Puppet messagePayload(4471187810177254022)
16:49:52 SILL Puppet messagePayloadCache(4471187810177254022) cache MISS
16:49:52 SILL Puppet messagePayload(4471187810177254022) cache SET
16:49:52 VERB Room ready()
16:49:52 SILL Contact ready() @ Puppet#0<PuppetPadlocal>() with id="wxid_8kg1wdu3jvk322"
16:49:52 SILL Contact ready() isReady() true

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.