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.
Files changed (2) hide show
  1. package/lib/index.js +10 -22
  2. 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 (config.showWaitingTip && !linkBuffer.has(key)) {
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
- const mid = tip?.messageId || tip?.id;
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();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-video-parser-all",
3
3
  "description": "Koishi 视频解析插件,支持抖音/快手/B站链接解析,可自定义API和解析规则",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [