koishi-plugin-nitter 0.0.11 → 0.0.13
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 +11 -5
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -50,7 +50,10 @@ async function retry(retries, fn, error_fn = (err) => {
|
|
|
50
50
|
return await fn();
|
|
51
51
|
} catch (err) {
|
|
52
52
|
console.log(`剩余${retries}次尝试`, err);
|
|
53
|
-
if (retries <= 1)
|
|
53
|
+
if (retries <= 1) {
|
|
54
|
+
error_fn(err);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
54
57
|
await new Promise((r) => setTimeout(r, delay));
|
|
55
58
|
return retry(retries - 1, fn, error_fn, delay * 2);
|
|
56
59
|
}
|
|
@@ -423,10 +426,13 @@ function apply(ctx, config) {
|
|
|
423
426
|
return tweetList.reverse();
|
|
424
427
|
}
|
|
425
428
|
__name(getFollowedFeed, "getFollowedFeed");
|
|
426
|
-
let checking
|
|
429
|
+
let checking;
|
|
427
430
|
async function checkForUpdates() {
|
|
428
|
-
if (checking)
|
|
429
|
-
|
|
431
|
+
if (checking) {
|
|
432
|
+
ctx.logger("nitter").info(`${new Date(checking).toLocaleTimeString()}开始的检查尚未完成`);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
checking = Date.now();
|
|
430
436
|
try {
|
|
431
437
|
const tweetList = await getFollowedFeed();
|
|
432
438
|
if (tweetList.length === 0) {
|
|
@@ -445,7 +451,7 @@ function apply(ctx, config) {
|
|
|
445
451
|
queue.push({ account: data.tweetBy.userName, tweetId: data.id });
|
|
446
452
|
}
|
|
447
453
|
} finally {
|
|
448
|
-
checking =
|
|
454
|
+
checking = void 0;
|
|
449
455
|
}
|
|
450
456
|
}
|
|
451
457
|
__name(checkForUpdates, "checkForUpdates");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-nitter",
|
|
3
3
|
"description": "使用Rettiwt-API订阅推文,并使用nitter渲染",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"fluent-ffmpeg": "^2.1.3",
|
|
26
26
|
"node-cron": "^4.2.1",
|
|
27
|
-
"rettiwt-api": "^6.1
|
|
27
|
+
"rettiwt-api": "^6.2.1"
|
|
28
28
|
}
|
|
29
29
|
}
|