@impulsedev/chameleon 3.7.0 → 3.7.1
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/dist/index.d.ts +5 -2
- package/dist/index.js +13 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3675,9 +3675,12 @@ declare function combinePermissions(...flags: bigint[]): bigint;
|
|
|
3675
3675
|
declare function listPermissions(permissions: string | bigint): string[];
|
|
3676
3676
|
|
|
3677
3677
|
declare class Chameleon {
|
|
3678
|
+
private static lastCpuUsage;
|
|
3679
|
+
private static lastCheck;
|
|
3678
3680
|
static get lifespan(): {
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
+
ram: number;
|
|
3682
|
+
uptime: number;
|
|
3683
|
+
cpu: number;
|
|
3681
3684
|
};
|
|
3682
3685
|
}
|
|
3683
3686
|
|
package/dist/index.js
CHANGED
|
@@ -1266,7 +1266,7 @@ var ChameleonGateway = class {
|
|
|
1266
1266
|
// package.json
|
|
1267
1267
|
var package_default = {
|
|
1268
1268
|
name: "@impulsedev/chameleon",
|
|
1269
|
-
version: "3.
|
|
1269
|
+
version: "3.7.0",
|
|
1270
1270
|
description: "highly optimized, memory-efficient, and fully type-safe Discord API library",
|
|
1271
1271
|
main: "dist/index.js",
|
|
1272
1272
|
types: "dist/index.d.ts",
|
|
@@ -5167,16 +5167,21 @@ function listPermissions(permissions) {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
|
|
5169
5169
|
// src/utils/chameleon.ts
|
|
5170
|
-
import os from "os";
|
|
5171
5170
|
var Chameleon = class {
|
|
5171
|
+
static lastCpuUsage = process.cpuUsage();
|
|
5172
|
+
static lastCheck = process.hrtime.bigint();
|
|
5172
5173
|
static get lifespan() {
|
|
5174
|
+
const mem = process.memoryUsage();
|
|
5175
|
+
const now = process.hrtime.bigint();
|
|
5176
|
+
const usage = process.cpuUsage(this.lastCpuUsage);
|
|
5177
|
+
const elapsedUs = Number(now - this.lastCheck) / 1e3;
|
|
5178
|
+
const cpuPercent = (usage.user + usage.system) / elapsedUs * 100;
|
|
5179
|
+
this.lastCpuUsage = process.cpuUsage();
|
|
5180
|
+
this.lastCheck = now;
|
|
5173
5181
|
return {
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
get cpu() {
|
|
5178
|
-
return os.loadavg()[0];
|
|
5179
|
-
}
|
|
5182
|
+
ram: Math.round(mem.rss / 1024 / 1024),
|
|
5183
|
+
uptime: Math.round(process.uptime() * 1e3),
|
|
5184
|
+
cpu: Math.round(cpuPercent * 100) / 100
|
|
5180
5185
|
};
|
|
5181
5186
|
}
|
|
5182
5187
|
};
|