koishi-plugin-video-parser-all 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +10 -22
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -246,30 +246,18 @@ function apply(ctx, config) {
|
|
|
246
246
|
if (!urls.length)
|
|
247
247
|
return;
|
|
248
248
|
const key = `${session.platform}:${session.userId}:${session.channelId}`;
|
|
249
|
-
if (
|
|
249
|
+
if (linkBuffer.has(key))
|
|
250
|
+
return;
|
|
251
|
+
let mid;
|
|
252
|
+
if (config.showWaitingTip) {
|
|
250
253
|
const tip = await session.send(config.waitingTipText).catch(() => null);
|
|
251
|
-
|
|
252
|
-
linkBuffer.set(key, {
|
|
253
|
-
urls,
|
|
254
|
-
timer: setTimeout(() => flush(session), config.messageBufferDelay * 1000),
|
|
255
|
-
tipMsgId: mid,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
const ex = linkBuffer.get(key);
|
|
260
|
-
if (ex) {
|
|
261
|
-
clearTimeout(ex.timer);
|
|
262
|
-
ex.urls.push(...urls);
|
|
263
|
-
ex.timer = setTimeout(() => flush(session), config.messageBufferDelay * 1000);
|
|
264
|
-
linkBuffer.set(key, ex);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
linkBuffer.set(key, {
|
|
268
|
-
urls,
|
|
269
|
-
timer: setTimeout(() => flush(session), config.messageBufferDelay * 1000),
|
|
270
|
-
});
|
|
271
|
-
}
|
|
254
|
+
mid = tip?.messageId || tip?.id;
|
|
272
255
|
}
|
|
256
|
+
linkBuffer.set(key, {
|
|
257
|
+
urls,
|
|
258
|
+
timer: setTimeout(() => flush(session), config.messageBufferDelay * 1000),
|
|
259
|
+
tipMsgId: mid,
|
|
260
|
+
});
|
|
273
261
|
});
|
|
274
262
|
setInterval(() => {
|
|
275
263
|
const now = Date.now();
|