Closed xuwancheng closed 3 years ago
升级hostie版本 0.11.5
提供所发图片的原图,接收图片的时间和图片大小有关。
先把图片发给您
这边测试基本1秒左右就能收到。
问题可能还是发生在wechaty-puppet-hostie的版本问题,我这边用的是NodeJS,这边就只运行了npm install wechaty@next, 我在package.json里面并没有发现有wechaty-puppet-hostie这个配置,然后我就手动执行了npm install wechaty-puppet-hostie, 然后看到"wechaty-puppet-hostie": "^0.10.8" 这一行,请问如何将版本升级到0.11.5?
贴一下我这边的代码: const { Wechaty } = require('wechaty'); const { ScanStatus } = require('wechaty-puppet'); const QrcodeTerminal = require('qrcode-terminal');
const token = 'XXXX'
const bot = new Wechaty({ puppet: 'wechaty-puppet-hostie', puppetOptions: { token, } });
bot
.on('scan', (qrcode, status) => {
if (status === ScanStatus.Waiting) {
QrcodeTerminal.generate(qrcode, {
small: true
})
}
})
.on('login', async user => {
console.log(user: ${JSON.stringify(user)}
)
})
.on('message', async message => {
console.log(message: ${JSON.stringify(message)}
)
})
.start()
重新安装下wechaty即可
我删除了所有的Module,然后执行npm install wechaty, 只有wechaty的版本,应该是最新的,但是并没有看到wechaty-puppet-hostie的包,还需要执行什么命令吗?怎么知道wechaty-puppet-hostie的版本号?
npm ls wechaty-puppet-hostie
运行了命令,查看到版本号是最新的,但是我测试过后问题依旧,还是需要等待10多秒才会进入函数,我有一个猜想:会不会是因为你那边在内部环境,而我这边是在外部环境造成的?
PS D:\P-WeRobot\SourceCode_V2.1\WeRobotClientDonut1> npm ls wechaty-puppet-hostie
Debugger attached.
werobotdonut@0.0.1 D:\P-WeRobot\SourceCode_V2.1\WeRobotClientDonut1
-- wechaty@0.49.8
-- wechaty-puppet-hostie@0.11.5
或者是恰巧分配给我的那台主机性能比较差,对图片处理速度慢?
我发现package-lock.json里面的版本为什么是0.11.0呢,我删除了重新安装的 "wechaty": { "version": "0.49.8", "resolved": "https://registry.npmjs.org/wechaty/-/wechaty-0.49.8.tgz", "integrity": "sha512-MQSuwbp32zgyZjxAzWRa8RrPf0jnPpttXnrq42M6P7LmE15gUPB7e+1jMg3MxbsxXsMwXMQqYG182sIo2Ens4w==", "requires": { "brolog": "^1.12.4", "clone-class": "^0.7.3", "cuid": "^2.1.8", "dotenv": "^8.2.0", "in-gfw": "^1.2.0", "json-rpc-peer": "^0.17.0", "npm-programmatic": "0.0.12", "open-graph": "^0.2.4", "opencollective": "^1.0.3", "opencollective-postinstall": "^2.0.3", "pkg-dir": "^5.0.0", "portfinder": "^1.0.28", "promise-retry": "^2.0.1", "raven": "^2.6.4", "read-pkg-up": "^7.0.1", "state-switch": "^0.9.9", "typed-emitter": "^1.3.1", "watchdog": "^0.8.17", "wechaty-puppet": "^0.33.3", "wechaty-puppet-hostie": "^0.11.0", "ws": "^7.3.1" }
这边给你开了一个临时测试的token: puppet_donut_b8819e4a46f6605c
你用这个测试下看看
"wechaty-puppet-hostie": "^0.11.0",
你需要理解下 ^
的含义
谢谢你的提醒关于^的含义,我刚才用你提供的测试的token测试,发现问题依旧,文字消息是秒到的,图片消息还是10秒以上,问题没有得到解决,您那边如果方便,我这边可以开远程桌面给你看下,方便问题的寻找,我的电话18662591312,如果您需要语音了解的话
你可以把接收到的图片消息的详细日志打印一下,列到comment中。
message payload中有对应的timestamp 看下详细日志再说吧。
WECHATY_LOG=silly ts-node index.ts
我这边收到的消息JSON格式化是这样的,那个WECHATY_LOG=silly ts-node index.ts我这边不是typescript的,我研究下怎么加上去
{
"_events": {},
"_eventsCount": 0,
"id": "5099372405356501864",
"payload": {
"filename": "",
"fromId": "q34539890",
"id": "5099372405356501864",
"mentionIdList": [],
"roomId": "",
"text": "<?xml version=\"1.0\"?>\n
请提供相对完整的日志,局部日志难以排查问题,至少接收消息日志的对应时间要有。
cross-env WECHATY_LOG=SILLY node test/index.js
Debugger attached.
Debugger attached.
16:53:13 SILL Puppet Config: WECHATY_LOG set level to SILLY
16:53:16 INFO Config registering process.on("unhandledRejection") for development/debug
16:53:16 VERB Config constructor()
16:53:24 VERB Wechaty constructor()
16:53:24 VERB StateSwitch constructor(Wechaty, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
16:53:24 VERB StateSwitch constructor(WechatyReady, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
16:53:24 VERB Wechaty on(scan, listener) registering... listenerCount: 0
16:53:24 VERB Wechaty on(login, listener) registering... listenerCount: 0
16:53:24 VERB Wechaty on(message, listener) registering... listenerCount: 0
16:53:24 VERB Wechaty
接收消息的日志时间:16:53:49
消息实际发送时间:2020-11-13 16:53:44
这个时间差是5s
你这个是用文件助手发的图片,你可以尝试接收联系人发的图片试试。
我这边试了,用另外一个联系人发给我,问题是一样的,下面的Logo前后有一点点是其他的干扰消息,你看中间主要的
17:04:50 SILL Contact ready() @ Puppet#0
你上面说的是5秒,但是我这边从转发出去开始到断点被触发,我自己数了一下,有10秒左右
17:05:42 "timestamp":1605258338000 => 2020-11-13 17:05:38 你自行这样排查下吧。目前来看没有你说的10秒以上的情况
我跟踪了一下Logo,我从17:16:00左右转发图片出去,一直等待到17:16:13才开始打印,单后图片的时间戳时间是17:16:8,从0秒到13才开始打印Logo,从0秒到图片的时间戳0秒之间,不知道系统在做什么?
17:15:59 VERB PuppetHostie onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload:"{"data":"[object Object]"}"})
17:15:59 SILL Wechaty memoryCheck() free: 2191 MB, require: 4 MB
17:16:13 VERB PuppetHostie onGrpcStreamEvent({type:EVENT_TYPE_MESSAGE(2), payload:"{"messageId":"3810917686360629709"}"})
17:16:13 SILL Wechaty memoryCheck() free: 2199 MB, require: 4 MB
17:16:13 VERB Message static load(3810917686360629709)
17:16:13 VERB Message constructor(3810917686360629709) for class WechatifiedMessage
17:16:13 VERB Message ready()
17:16:13 VERB Puppet messagePayload(3810917686360629709)
17:16:13 SILL Puppet messagePayloadCache(3810917686360629709) cache MISS
17:16:13 VERB PuppetHostie messageRawPayload(3810917686360629709)
17:16:14 SILL Puppet messagePayload(3810917686360629709) cache SET
17:16:14 VERB Room ready()
17:16:14 SILL Contact ready() @ Puppet#0
日志没有显示出0-10秒的行为,时间应该就是在这里被浪费的
/>\n\n","timestamp":1605258968000,"toId":"","type":6}}
这个是你发送图片的实际时间 2020-11-13 17:16:08
我从17:16:00左右转发图片出去
与你说的有较大差异。
17:16:14 接收到该条消息
17:16:14 - 17:16:08 = 6
0. Report Issue Guide
Please run the following command and check whether the problem has been fixed:
Please search in FAQ List first, and make sure your problem has not been solved before.
Please search in the issue first, and make sure your problem had not been reported before
1. Versions
What is your wechaty version? Answer: 0.49.8
What is your wechaty-puppet-donut version? Answer: "wechaty-puppet-hostie": "^0.10.8",
What is your node version? (run
node --version
) Answer: 14What os are you using Answer: Windows 10
2. Describe the bug
发送图片的时候,message的回调特别慢,达到10多秒(基本没有10秒以内),而PadPlus的协议的只需要1-2秒就可以触发,我用的就是Example里面的代码。 .on('message', async message => { console.log(
message: ${JSON.stringify(message)}
) })3. To Reproduce
我用的就是Example里面的代码,也做了对比视频,已经发给Juzi.BOT。
4. Expected behavior
希望跟PadPlus的速度差不多
5. Actual behavior
现在的反应时间是10-15秒
6. Full Output Logs
程序没有出错,没有设置Log
Show Logs
```shell $ WECHATY_LOG=silly node yourbot.js Question: Paste your FULL(DO NOT ONLY PROVIDE FRAGMENTS) log messages Answer: ```7. Additional context
Add any other context about the problem here.
[bug]