Open zhoumh1988 opened 5 years ago
退出登录时需要获取到用户名称,并发邮件出来。 举例:Contact <小明> logout at 2019-01-18 15:29:35
Contact logout at 2019-01-18 15:29:35
bot.on('logout', (user) => { let msg = `${user} logout at ${moment().format('YYYY-MM-DD HH:mm:ss')}`; console.warn(msg); info.warn(msg); // MQPusher是我写的一个消息队列类 MQPusher.push(`${user} logout at ${moment().format('YYYY-MM-DD HH:mm:ss')}`, 3); });
改为
bot.on('logout', (user) => { let msg = `${user} logout at ${moment().format('YYYY-MM-DD HH:mm:ss')}`; console.warn(msg); info.warn(msg); MQPusher.push(msg, 3); });
原来到代码是调用了2次user对象去获取,猜测在第二次调用的时候user对象应该是被释放了,因此再次调用user的时候user找不到了,是一个空对象。
Thanks for posting the issue and your solutions here, we will put this into our F&Q.
1. 版本信息
2. 期待程序运行的结果
3. 程序实际运行的结果
4. 解决的步骤
改为
5. 分析原因