File tree 3 files changed +8
-8
lines changed
3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const { setTimeout: sleep } = require('node:timers/promises');
8
8
const { Collection } = require ( '@discordjs/collection' ) ;
9
9
const Shard = require ( './Shard' ) ;
10
10
const { Error, TypeError, RangeError, ErrorCodes } = require ( '../errors' ) ;
11
- const { mergeDefault, fetchRecommendedShards } = require ( '../util/Util' ) ;
11
+ const { mergeDefault, fetchRecommendedShardCount } = require ( '../util/Util' ) ;
12
12
13
13
/**
14
14
* This is a utility class that makes multi-process sharding of a bot an easy and painless experience.
@@ -187,7 +187,7 @@ class ShardingManager extends EventEmitter {
187
187
async spawn ( { amount = this . totalShards , delay = 5500 , timeout = 30_000 } = { } ) {
188
188
// Obtain/verify the number of shards to spawn
189
189
if ( amount === 'auto' ) {
190
- amount = await fetchRecommendedShards ( this . token ) ;
190
+ amount = await fetchRecommendedShardCount ( this . token ) ;
191
191
} else {
192
192
if ( typeof amount !== 'number' || isNaN ( amount ) ) {
193
193
throw new TypeError ( ErrorCodes . ClientInvalidOption , 'Amount of shards' , 'a number.' ) ;
Original file line number Diff line number Diff line change @@ -211,18 +211,18 @@ function escapeSpoiler(text) {
211
211
}
212
212
213
213
/**
214
- * @typedef {Object } FetchRecommendedShardsOptions
214
+ * @typedef {Object } FetchRecommendedShardCountOptions
215
215
* @property {number } [guildsPerShard=1000] Number of guilds assigned per shard
216
216
* @property {number } [multipleOf=1] The multiple the shard count should round up to. (16 for large bot sharding)
217
217
*/
218
218
219
219
/**
220
220
* Gets the recommended shard count from Discord.
221
221
* @param {string } token Discord auth token
222
- * @param {FetchRecommendedShardsOptions } [options] Options for fetching the recommended shard count
222
+ * @param {FetchRecommendedShardCountOptions } [options] Options for fetching the recommended shard count
223
223
* @returns {Promise<number> } The recommended number of shards
224
224
*/
225
- async function fetchRecommendedShards ( token , { guildsPerShard = 1_000 , multipleOf = 1 } = { } ) {
225
+ async function fetchRecommendedShardCount ( token , { guildsPerShard = 1_000 , multipleOf = 1 } = { } ) {
226
226
if ( ! token ) throw new DiscordError ( ErrorCodes . TokenMissing ) ;
227
227
const response = await fetch ( RouteBases . api + Routes . gatewayBot ( ) , {
228
228
method : 'GET' ,
@@ -555,7 +555,7 @@ module.exports = {
555
555
escapeUnderline,
556
556
escapeStrikethrough,
557
557
escapeSpoiler,
558
- fetchRecommendedShards ,
558
+ fetchRecommendedShardCount ,
559
559
parseEmoji,
560
560
resolvePartialEmoji,
561
561
mergeDefault,
Original file line number Diff line number Diff line change @@ -2290,7 +2290,7 @@ export class ShardingManager extends EventEmitter {
2290
2290
public once ( event : 'shardCreate' , listener : ( shard : Shard ) => Awaitable < void > ) : this;
2291
2291
}
2292
2292
2293
- export interface FetchRecommendedShardsOptions {
2293
+ export interface FetchRecommendedShardCountOptions {
2294
2294
guildsPerShard ?: number ;
2295
2295
multipleOf ?: number ;
2296
2296
}
@@ -2640,7 +2640,7 @@ export function escapeUnderline(text: string): string;
2640
2640
export function escapeStrikethrough ( text : string ) : string ;
2641
2641
export function escapeSpoiler ( text : string ) : string ;
2642
2642
export function cleanCodeBlockContent ( text : string ) : string ;
2643
- export function fetchRecommendedShards ( token : string , options ?: FetchRecommendedShardsOptions ) : Promise < number > ;
2643
+ export function fetchRecommendedShardCount ( token : string , options ?: FetchRecommendedShardCountOptions ) : Promise < number > ;
2644
2644
export function flatten ( obj : unknown , ...props : Record < string , boolean | string > [ ] ) : unknown ;
2645
2645
export function makeError ( obj : MakeErrorOptions ) : Error ;
2646
2646
export function makePlainError ( err : Error ) : MakeErrorOptions ;
You can’t perform that action at this time.
0 commit comments