xernerx 4.4.0 → 4.4.2
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,7 +1,7 @@
|
|
|
1
|
-
import { ShardingManager, ShardingManagerOptions } from 'discord.js';
|
|
1
|
+
import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
|
|
2
2
|
interface XernerxOptions {
|
|
3
3
|
log?: {
|
|
4
|
-
ready
|
|
4
|
+
ready?: boolean;
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
7
|
export default class XernerxShardClient extends ShardingManager {
|
|
@@ -10,6 +10,7 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
10
10
|
userCount: number;
|
|
11
11
|
shardCount: number;
|
|
12
12
|
};
|
|
13
|
+
user: ClientUser | null;
|
|
13
14
|
constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -4,8 +4,8 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
4
4
|
constructor(file, discordOptions, xernerxOptions) {
|
|
5
5
|
super(file, discordOptions);
|
|
6
6
|
this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };
|
|
7
|
+
this.user = null;
|
|
7
8
|
this.on('shardCreate', async (shard) => {
|
|
8
|
-
new XernerxLog({ settings: xernerxOptions }).info(`Launching shard ${shard.id}`);
|
|
9
9
|
shard.on('ready', async () => {
|
|
10
10
|
const guilds = await shard.fetchClientValue('guilds.cache');
|
|
11
11
|
const guildCount = guilds.length;
|
|
@@ -13,13 +13,17 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
13
13
|
this.stats.guildCount += Number(guildCount);
|
|
14
14
|
this.stats.userCount += Number(userCount);
|
|
15
15
|
this.stats.shardCount++;
|
|
16
|
+
this.user = await shard.fetchClientValue('user');
|
|
16
17
|
});
|
|
18
|
+
new XernerxLog({ settings: xernerxOptions }).info(`Launching shard ${shard.id} for ${this.user?.tag}!`);
|
|
17
19
|
});
|
|
18
20
|
this.spawn().then(async (shards) => {
|
|
19
21
|
const collector = setInterval(() => {
|
|
20
22
|
const index = shards.size - 1;
|
|
21
23
|
if (shards.get(index)?.ready) {
|
|
22
|
-
new XernerxLog({ settings: xernerxOptions }).info(
|
|
24
|
+
new XernerxLog({ settings: xernerxOptions }).info(
|
|
25
|
+
`Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`
|
|
26
|
+
);
|
|
23
27
|
clearInterval(collector);
|
|
24
28
|
}
|
|
25
29
|
}, 1000);
|