This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
Replies: 2 comments
-
写个防抖把账号存起来,变量里有该账号直接 return |
Beta Was this translation helpful? Give feedback.
0 replies
-
我是事件触发时设置定时器,超时或正确回复解除监听,清楚定时器 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
比如接收到私聊消息事件,此时处理该消息并回复他,他5分钟之后不回复就设置消息过时了
我的想法有两个:
1、对某个单独的消息使用
setInterval
计时,5分钟内他回复了,执行clearInterval
并且重新计时。这样的话,面对多人的消息,可以使用对象数组来存放每一个事件的定时器,感觉还是不够优雅。2、使用
node-schedule
库,每个消息设置一下5分钟之后的定时任务,如果他回复了,就取消之前的任务,并重新开始计时任务,但是这样感觉很笨各位有没有什么其他的设置超时的方法
Beta Was this translation helpful? Give feedback.
All reactions