Repository: discordjs/discord.js
File: packages/discord.js/src/util/Options.js (JavaScript)

Code before:
 * @returns {IShardingStrategy} The strategy to use for sharding
 */

/**
 * A function to change the concurrency handling for shard identifies of this manager
 * ```js
 * async (manager) => {
 *   const gateway = await manager.fetchGatewayInformation();
 *   return new SimpleIdentifyThrottler(gateway.session_start_limit.max_concurrency);
 * }
 * ```
 * @typedef {Function} IdentifyThrottlerFunction
 * @param {WSWebSocketManager} manager The WebSocketManager that is going to initiate the sharding
 * @returns {Awaitable<IIdentifyThrottler>} The identify throttler that this ws manager will use
 */

/**
 * WebSocket options (these are left as snake_case to match the API)
 * @typedef {Object} WebsocketOptions
 * @property {number} [large_threshold=50] Number of members in a guild after which offline users will no longer be
 * sent in the initial guild member list, must be between 50 and 250
 * @property {number} [version=10] The Discord gateway version to use <warn>Changing this can break the library;
 * only set this if you know what you are doing</warn>
 * @property {BuildStrategyFunction} [buildStrategy] Builds the strategy to use for sharding
 * @property {IdentifyThrottlerFunction} [buildIdentifyThrottler] Builds the identify throttler to use for sharding
 * @property {PresenceData} [presence] Presence data to use upon login
 */

/**
 * Contains various utilities for client options.
 */
class Options extends null {
  /**
   * The default user agent appendix.
   * @type {string}
   * @memberof Options
   * @private
   */
  static userAgentAppendix = `discord.js/${version} ${DefaultUserAgentAppendix}`.trimEnd();

  /**
   * The default client options.
   * @returns {ClientOptions}
   */
  static createDefault() {
    return {
      closeTimeout: 5_000,
      waitGuildTimeout: 15_000,
      shardCount: 1,
      makeCache: this.cacheWithLimits(this.DefaultMakeCacheSettings),
      partials: [],

Review comment (suggestion):
We should add `initialPresence` here because that’s what /ws uses and should be the property we suggest as alternative to the deprecated `ClientOptions#presence`.

Code after:
 * @returns {IShardingStrategy} The strategy to use for sharding
 */

/**
 * A function to change the concurrency handling for shard identifies of this manager
 * ```js
 * async (manager) => {
 *   const gateway = await manager.fetchGatewayInformation();
 *   return new SimpleIdentifyThrottler(gateway.session_start_limit.max_concurrency);
 * }
 * ```
 * @typedef {Function} IdentifyThrottlerFunction
 * @param {WSWebSocketManager} manager The WebSocketManager that is going to initiate the sharding
 * @returns {Awaitable<IIdentifyThrottler>} The identify throttler that this ws manager will use
 */

/**
 * WebSocket options (these are left as snake_case to match the API)
 * @typedef {Object} WebsocketOptions
 * @property {number} [large_threshold=50] Number of members in a guild after which offline users will no longer be
 * sent in the initial guild member list, must be between 50 and 250
 * @property {number} [version=10] The Discord gateway version to use <warn>Changing this can break the library;
 * only set this if you know what you are doing</warn>
 * @property {BuildStrategyFunction} [buildStrategy] Builds the strategy to use for sharding
 * @property {IdentifyThrottlerFunction} [buildIdentifyThrottler] Builds the identify throttler to use for sharding
 */

/**
 * Contains various utilities for client options.
 */
class Options extends null {
  /**
   * The default user agent appendix.
   * @type {string}
   * @memberof Options
   * @private
   */
  static userAgentAppendix = `discord.js/${version} ${DefaultUserAgentAppendix}`.trimEnd();

  /**
   * The default client options.
   * @returns {ClientOptions}
   */
  static createDefault() {
    return {
      closeTimeout: 5_000,
      waitGuildTimeout: 15_000,
      shardCount: 1,
      makeCache: this.cacheWithLimits(this.DefaultMakeCacheSettings),
      partials: [],
      failIfNotExists: true,