wechaty / puppet-wechat

Wechaty Puppet Provider for WeChat
https://www.npmjs.com/package/wechaty-puppet-wechat
Apache License 2.0
405 stars 67 forks source link

机器人启动后每次都是前几天可以用,过了几天后就开始报错 #179

Open J1angX1n opened 2 years ago

J1angX1n commented 2 years ago

我按照教程启动机器人后机器人每次前几天都是可以用的,过了几天后bot.Room.find就开始出问题了,之前能找得到的群名会开始返回null,下面是调用的代码和报错信息 代码:

bot.Room.find({topic: rn}).then(
                    room =>{
                        if(data!=""){
                            var temp = JSON.parse(data);
                            if((new Date().getTime())-(new Date(temp['date']).getTime())<3600*1000){
                                room.say(String(temp['message']));
                            }

                        }
                    }
                )

报错信息: 13:50:44 ERR Config ########################### 13:50:44 ERR Config unhandledRejection: TypeError: Cannot read property 'say' of null at file:///home/paladnix/wechat-robot/examples/ding-dong-bot.js:53:38 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:94:5) [object Promise] 13:50:44 ERR Config ########################### 13:50:44 ERR Config process.on(unhandledRejection) promise.catch(Cannot read property 'say' of null) Config TypeError: Cannot read property 'say' of null at file:///home/paladnix/wechat-robot/examples/ding-dong-bot.js:53:38 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:94:5)

huan commented 2 years ago

The bot.Room.find() might return undefined, which means that you need to check the resolved value before use it.

J1angX1n commented 2 years ago

The bot.Room.find() might return undefined, which means that you need to check the resolved value before use it.

但是一旦这段代码运行出了问题,此后每一次调用都是返回null,在那之前每次调用都是ok的,会不会是别的什么问题,我find查找的群名是固定的一直是一个群没变过

huan commented 2 years ago

If the room exists but you can not find it, then the problem must be related to the Puppet Provider(implementation).

Which puppet are you using?

J1angX1n commented 2 years ago

If the room exists but you can not find it, then the problem must be related to the Puppet Provider(implementation).

Which puppet are you using?

我就是参照了这个代码库里面的教程做的(getting-started,export WECHATY_PUPPET=wechaty-puppet-wechat),用的配置都是教程里配的默认的

huan commented 2 years ago

Thanks for the reporting.

I have moved this issue to puppet-wechat because it's a web protocol issue.

J1angX1n commented 2 years ago

Thanks for the reporting.

I have moved this issue to puppet-wechat because it's a web protocol issue.

好的,麻烦你了,我会先去尝试换个puppet,如果还有其他的解决办法的话还望大佬可以回复我xd