This repository has been archived by the owner on Aug 17, 2021. It is now read-only.
forked from discordware/eris-sharder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
104 lines (98 loc) · 3.07 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { EventEmitter } from 'events';
import { Channel, Client, ClientOptions, Guild, User } from 'eris';
declare module 'eris-sharder' {
export class Master extends EventEmitter {
public shardCount: number;
public firstShardID: number;
public lastShardID: number;
public clusterCount: number;
public clusterTimeout: number;
public token: string | false;
public clusters: Map<number, unknown>;
public workers: Map<number, unknown>;
public queue: Array<unknown>;
public eris: Client;
public options: {
stats: ErisSharderStats;
};
public statsInterval: number;
public mainFile: string;
public name: string;
public guildsPerShard: number;
public webhooks: {
cluster?: string;
shard?: string;
};
public debug: boolean;
public clientOptions: ClientOptions;
public callbacks: Map<number, any>;
constructor(token: string, mainFile: string, clientOptions?: SharderOptions);
public isMaster(): boolean;
public startStats(): void;
public executeStats(clusters: Array<unknown>, start: number): void;
public start(clusterID: number): void;
public launch(): void;
public chunk(shards: Array<number>, clusterCount: number): Array<Array<number>>
public connectShards(): void;
public sendWebhook(type: string, embed): void;
public printLogo(): void;
public restartCluster(worker: unknown, code: number): void;
public calculateShards(): Promise<number>;
public fetchInfo(start: number, type: unknown, value: unknown): void;
public broadcast(start: number, message: unknown): void;
public sendTo(cluster: unknown, message: unknown): void;
}
export class Base {
public bot: boolean;
public clusterID: number;
public ipc: ErisSharderIPC;
constructor(bot, clusterID?, ipc?);
public restartCluster(clusterID: number): void;
}
interface SharderOptions {
stats?: boolean;
webhooks?: {
shard: SharderWebhook;
cluster: SharderWebhook;
};
clientOptions?: ClientOptions;
clusters: number;
clusterTimeout?: number;
shards?: number;
firstShardID?: number;
lastShardID?: number;
debug?: boolean;
statsInterval?: number;
name?: string;
guildsPerShard?: number;
}
interface SharderWebhook {
id: string;
token: string;
}
interface ErisSharderIPC extends EventEmitter {
events: Map<string, ErisSharderEvent>;
register(event: string, callback: Function): void;
unregister(name: string): void;
broadcast(name: string, message?: unknown): void;
sendTo(cluster: number, name: string, message?: unknown): void;
fetchUser(id: string): Promise<User>;
fetchGuild(id: string): Promise<Guild>;
fetchChannel(id: string): Promise<Channel>;
}
interface ErisSharderEvent {
fn: (msg: unknown) => void;
}
interface ErisSharderStats {
stats: {
guilds: number;
users: number;
totalRam: number;
voice: number;
exclusiveGuilds: number;
largeGuilds: number;
clusters: Array<unknown>;
};
clustersCounted: number;
}
}