remove unused members
This commit is contained in:
parent
4c499ba708
commit
dd5360adcd
1
@types/Shared.d.ts
vendored
1
@types/Shared.d.ts
vendored
@ -6,7 +6,6 @@ export type PlainError = {
|
|||||||
|
|
||||||
export type EnvObject = {
|
export type EnvObject = {
|
||||||
[key: string]: unknown,
|
[key: string]: unknown,
|
||||||
SHARDING_MANAGER: boolean,
|
|
||||||
SHARD_ID: number,
|
SHARD_ID: number,
|
||||||
SHARD_COUNT: number,
|
SHARD_COUNT: number,
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,24 @@ import EventEmitter from 'node:events';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import childProcess, { ChildProcess } from 'node:child_process';
|
import childProcess, { ChildProcess } from 'node:child_process';
|
||||||
|
|
||||||
import { EnvObject, IPCMessage, PlainError } from '../../@types/Shared.js';
|
|
||||||
import Controller from './Controller.js';
|
import Controller from './Controller.js';
|
||||||
|
import Util from '../utilities/Util.js';
|
||||||
|
|
||||||
import { ShardOptions } from '../../@types/Shard.js';
|
import { ShardOptions } from '../../@types/Shard.js';
|
||||||
import { ClientOptions } from '../../@types/Client.js';
|
import { ClientOptions } from '../../@types/Client.js';
|
||||||
import Util from '../utilities/Util.js';
|
import { EnvObject, IPCMessage, PlainError } from '../../@types/Shared.js';
|
||||||
|
|
||||||
const KillTO = 90 * 1000;
|
const KillTO = 90 * 1000;
|
||||||
|
|
||||||
class Shard extends EventEmitter
|
class Shard extends EventEmitter
|
||||||
{
|
{
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
|
|
||||||
#debug: boolean;
|
|
||||||
#id: number;
|
#id: number;
|
||||||
#controller: Controller;
|
#controller: Controller;
|
||||||
#env: EnvObject; // { [key: string]: string | boolean | number };
|
#env: EnvObject;
|
||||||
#ready: boolean;
|
#ready: boolean;
|
||||||
|
#debug: boolean;
|
||||||
#clientOptions: ClientOptions;
|
#clientOptions: ClientOptions;
|
||||||
|
|
||||||
#args: string[];
|
#args: string[];
|
||||||
@ -50,20 +52,14 @@ class Shard extends EventEmitter
|
|||||||
throw new Error('Missing file');
|
throw new Error('Missing file');
|
||||||
this.#file = options.file;
|
this.#file = options.file;
|
||||||
this.#respawn = options.respawn ?? true;
|
this.#respawn = options.respawn ?? true;
|
||||||
if (!options.token)
|
|
||||||
throw new Error('Missing token');
|
|
||||||
|
|
||||||
this.#env = {
|
this.#env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
SHARDING_MANAGER: true, // IMPORTANT, SHARD IPC WILL BREAK IF MISSING
|
|
||||||
SHARDING_MANAGER_MODE: 'process', // IMPORTANT, SHARD IPC WILL BREAK IF MISSING
|
|
||||||
SHARDS: this.#id,
|
SHARDS: this.#id,
|
||||||
SHARD_ID: this.#id,
|
SHARD_ID: this.#id,
|
||||||
SHARD_COUNT: options.totalShards,
|
SHARD_COUNT: options.totalShards,
|
||||||
DISCORD_TOKEN: options.token
|
|
||||||
};
|
};
|
||||||
if (!options.clientOptions?.libraryOptions)
|
|
||||||
throw new Error('Missing library options, must provide intents');
|
|
||||||
this.#clientOptions = options.clientOptions || {};
|
this.#clientOptions = options.clientOptions || {};
|
||||||
|
|
||||||
this.#ready = false;
|
this.#ready = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user