seyfert 5.0.1-dev-33922311634.0 → 5.1.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DefaultUserAgent: "DiscordBot (https://seyfert.dev, v5.
|
|
1
|
+
export declare const DefaultUserAgent: "DiscordBot (https://seyfert.dev, v5.1.0)";
|
|
2
2
|
export declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
|
|
3
3
|
export declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
|
|
4
4
|
export declare const ALLOWED_SIZES: readonly [16, 32, 64, 100, 128, 256, 512, 1024, 2048, 4096];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ALLOWED_TAG_BADGE_EXTENSIONS = exports.ALLOWED_SOUNDS_EXTENSIONS = exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
|
|
4
|
-
exports.DefaultUserAgent = 'DiscordBot (https://seyfert.dev, v5.
|
|
4
|
+
exports.DefaultUserAgent = 'DiscordBot (https://seyfert.dev, v5.1.0)';
|
|
5
5
|
exports.ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
|
|
6
6
|
exports.ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'];
|
|
7
7
|
exports.ALLOWED_SIZES = [16, 32, 64, 100, 128, 256, 512, 1_024, 2_048, 4_096];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WorkerManagerDefaults = exports.ShardManagerDefaults = exports.properties = exports.COMPRESS = void 0;
|
|
4
4
|
const COMPRESS = false;
|
|
5
5
|
exports.COMPRESS = COMPRESS;
|
|
6
|
-
const propertiesVersion = 'Seyfert v5.
|
|
6
|
+
const propertiesVersion = 'Seyfert v5.1.0 (https://seyfert.dev)';
|
|
7
7
|
const properties = {
|
|
8
8
|
os: process.platform,
|
|
9
9
|
browser: propertiesVersion,
|
|
@@ -8,11 +8,14 @@ export declare class ConnectTimeout {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class ConnectQueue {
|
|
10
10
|
intervalTime: number;
|
|
11
|
-
concurrency: number;
|
|
12
11
|
private queue;
|
|
12
|
+
private _concurrency;
|
|
13
13
|
private remaining;
|
|
14
|
+
private lastTickAt?;
|
|
14
15
|
protected interval?: NodeJS.Timeout;
|
|
15
16
|
constructor(intervalTime?: number, concurrency?: number);
|
|
17
|
+
get concurrency(): number;
|
|
18
|
+
set concurrency(concurrency: number);
|
|
16
19
|
push(callback: () => unknown): unknown;
|
|
17
20
|
startInterval(): void;
|
|
18
21
|
}
|
|
@@ -30,17 +30,42 @@ class ConnectTimeout {
|
|
|
30
30
|
exports.ConnectTimeout = ConnectTimeout;
|
|
31
31
|
class ConnectQueue {
|
|
32
32
|
intervalTime;
|
|
33
|
-
concurrency;
|
|
34
33
|
queue = [];
|
|
34
|
+
_concurrency;
|
|
35
35
|
remaining = 0;
|
|
36
|
+
lastTickAt;
|
|
36
37
|
interval = undefined;
|
|
37
38
|
constructor(intervalTime = 5000, concurrency = 1) {
|
|
38
39
|
this.intervalTime = intervalTime;
|
|
39
|
-
this.
|
|
40
|
+
this._concurrency = concurrency;
|
|
40
41
|
this.remaining = concurrency;
|
|
41
42
|
}
|
|
43
|
+
get concurrency() {
|
|
44
|
+
return this._concurrency;
|
|
45
|
+
}
|
|
46
|
+
set concurrency(concurrency) {
|
|
47
|
+
if (concurrency === this._concurrency)
|
|
48
|
+
return;
|
|
49
|
+
const consumed = this._concurrency - this.remaining;
|
|
50
|
+
this._concurrency = concurrency;
|
|
51
|
+
this.remaining = concurrency - consumed;
|
|
52
|
+
while (this.remaining > 0) {
|
|
53
|
+
const callback = this.queue.shift();
|
|
54
|
+
if (!callback)
|
|
55
|
+
break;
|
|
56
|
+
this.remaining--;
|
|
57
|
+
callback();
|
|
58
|
+
}
|
|
59
|
+
if (this.interval)
|
|
60
|
+
clearTimeout(this.interval);
|
|
61
|
+
this.interval = undefined;
|
|
62
|
+
if (this.remaining < this._concurrency || this.queue.length)
|
|
63
|
+
this.startInterval();
|
|
64
|
+
else
|
|
65
|
+
this.lastTickAt = undefined;
|
|
66
|
+
}
|
|
42
67
|
push(callback) {
|
|
43
|
-
if (this.remaining
|
|
68
|
+
if (this.remaining <= 0)
|
|
44
69
|
return this.queue.push(callback);
|
|
45
70
|
this.remaining--;
|
|
46
71
|
if (!this.interval) {
|
|
@@ -52,20 +77,31 @@ class ConnectQueue {
|
|
|
52
77
|
return this.queue.push(callback);
|
|
53
78
|
}
|
|
54
79
|
startInterval() {
|
|
55
|
-
this.
|
|
80
|
+
this.lastTickAt ??= Date.now();
|
|
81
|
+
const delay = Math.max(0, this.lastTickAt + this.intervalTime / this.concurrency - Date.now());
|
|
82
|
+
this.interval = setTimeout(() => {
|
|
83
|
+
this.lastTickAt = Date.now();
|
|
84
|
+
this.interval = undefined;
|
|
85
|
+
if (this.remaining < 0) {
|
|
86
|
+
this.remaining++;
|
|
87
|
+
this.startInterval();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
56
90
|
let cb;
|
|
57
91
|
while (this.queue.length && !(cb = this.queue.shift())) {
|
|
58
92
|
//
|
|
59
93
|
}
|
|
60
|
-
if (cb)
|
|
94
|
+
if (cb) {
|
|
95
|
+
this.startInterval();
|
|
61
96
|
return cb?.();
|
|
62
|
-
if (this.remaining < this.concurrency)
|
|
63
|
-
return this.remaining++;
|
|
64
|
-
if (!this.queue.length) {
|
|
65
|
-
clearInterval(this.interval);
|
|
66
|
-
this.interval = undefined;
|
|
67
97
|
}
|
|
68
|
-
|
|
98
|
+
if (this.remaining < this.concurrency) {
|
|
99
|
+
this.remaining++;
|
|
100
|
+
this.startInterval();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.lastTickAt = undefined;
|
|
104
|
+
}, delay);
|
|
69
105
|
}
|
|
70
106
|
}
|
|
71
107
|
exports.ConnectQueue = ConnectQueue;
|