fnlb 0.0.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/README.md +0 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface FNLBConfig {
|
|
4
|
+
disableLogs?: boolean;
|
|
5
|
+
disableErrorLogs?: boolean;
|
|
6
|
+
disableSubProcessLogs?: boolean;
|
|
7
|
+
disableSubProcessErrorLogs?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface StartConfig {
|
|
10
|
+
token: string;
|
|
11
|
+
categories?: string[];
|
|
12
|
+
numberOfShards?: number;
|
|
13
|
+
botsPerShard?: number;
|
|
14
|
+
hideUsernames?: boolean;
|
|
15
|
+
hideEmails?: boolean;
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class FNLB {
|
|
19
|
+
private isLoaded;
|
|
20
|
+
private config?;
|
|
21
|
+
constructor(config?: FNLBConfig);
|
|
22
|
+
private log;
|
|
23
|
+
private warn;
|
|
24
|
+
private error;
|
|
25
|
+
update(): Promise<void>;
|
|
26
|
+
start(config: StartConfig): Promise<Promise<import("child_process").ChildProcess>[]>;
|
|
27
|
+
startShard(config: StartConfig, id: string): Promise<import("child_process").ChildProcess>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
FNLB as default,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fork as h} from"node:child_process";import l from"node:fs";import g from"node:path";class i{static wait(t){return new Promise((r)=>setTimeout(r,t))}}var p={GATEWAY_URL:"https://gateway.fnlb.net",CDN_URL:"https://cdn.fnlb.net",ENIGMA_URL:"https://void.fnlb.net"};class o{isLoaded=!1;config;constructor(t){this.config=t}log(...t){if(!this.config?.disableLogs)console.log("[FNLB ShardingManager]",...t)}warn(...t){if(!this.config?.disableErrorLogs)console.warn("[FNLB ShardingManager]",...t)}error(...t){if(!this.config?.disableErrorLogs)console.error("[FNLB ShardingManager]",...t)}async update(){if(this.isLoaded)return;this.log("Checking for updates...");const r=await fetch("https://dist.fnlb.net/packages/zenith/release");if(!r.ok)throw new Error(`[FNLB ShardingManager] Failed to check for updates, status code: ${r.status}`);const e=(await r.json()).url,a=await fetch(e);if(!a.ok)throw new Error(`[FNLB ShardingManager] Failed to download update, status code: ${a.status}`);const n=await a.text(),d=g.join("zenith.js");l.writeFileSync(d,n),this.isLoaded=!0}async start(t){if(!t?.token)throw new Error("[FNLB ShardingManager] Please provide a FNLB token.");await this.update();const r=t.numberOfShards??1,s=[];for(let e=0;e<r;e++){const a=new Date;s.push(this.startShard(t,`${e.toString().padStart(2,"0")}/${a.getDay()}${a.getHours()}${a.getMinutes()}${a.getSeconds()}`))}return s}async startShard(t,r){if(await this.update(),!t?.token)throw new Error("[FNLB ShardingManager] Please provide a FNLB token.");this.log("Starting shard with id:",r);const s=h("zenith.js",{env:{...process.env,...p,FORCE_COLOR:"1",SHARD_ID:r,API_TOKEN:t.token,CATEGORIES:t.categories?.join(","),BOTS_PER_SHARD:(t.botsPerShard??15).toString(),HIDE_USERNAMES:t.hideUsernames?"true":"false",HIDE_EMAILS:t.hideEmails?"true":"false",DEBUG:t.debug?"true":"false"}});if(!this.config?.disableSubProcessLogs)s.stdout?.on("data",(e)=>{process.stdout.write(e.toString("utf8"))});if(!this.config?.disableSubProcessErrorLogs)s.stderr?.on("data",(e)=>{process.stderr.write(e.toString("utf8"))});return s.on("close",async(e)=>{if(e===0)this.warn("Child process exited with code:",e?.toString()??"none");else this.error("Child process exited with code:",e?.toString()??"none");this.log("Trying to restart process..."),await i.wait(1e4),this.startShard(t,r)}),s}}var F=o;export{F as default};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fnlb",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Fortnite LobbyBot Module",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "bun run src/build.ts",
|
|
10
|
+
"prepublishOnly": "bun run lint && bun run build",
|
|
11
|
+
"test": "bun run test/index.ts",
|
|
12
|
+
"lint": "bun run lint:biome && bun run lint:tsc",
|
|
13
|
+
"lint:biome": "bunx --bun @biomejs/biome check --write .",
|
|
14
|
+
"lint:tsc": "bun tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"author": "FNLB-Project",
|
|
18
|
+
"files": ["dist"],
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"dependencies": {},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@biomejs/biome": "^1.8.3",
|
|
23
|
+
"@types/bun": "^1.1.6",
|
|
24
|
+
"bun-plugin-dts": "^0.2.1",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
26
|
+
"@typescript-eslint/parser": "^7.14.1",
|
|
27
|
+
"eslint": "^9.6.0"
|
|
28
|
+
},
|
|
29
|
+
"packageManager": "bun@1.1.17",
|
|
30
|
+
"trustedDependencies": ["@biomejs/biome"]
|
|
31
|
+
}
|