refactor(IContextFetchingStrategy): explicitly name forwarded properties (#10652)

This commit is contained in:
Denis-Adrian Cristea
2024-12-10 08:34:15 +02:00
committed by Jiralite
parent b26af3cf38
commit 737a97d068

View File

@@ -3,15 +3,20 @@ import type { APIGatewayBotInfo } from 'discord-api-types/v10';
import type { SessionInfo, WebSocketManager, WebSocketManagerOptions } from '../../ws/WebSocketManager.js';
export interface FetchingStrategyOptions
extends Omit<
extends Pick<
WebSocketManagerOptions,
| 'buildIdentifyThrottler'
| 'buildStrategy'
| 'rest'
| 'retrieveSessionInfo'
| 'shardCount'
| 'shardIds'
| 'updateSessionInfo'
| 'compression'
| 'encoding'
| 'handshakeTimeout'
| 'helloTimeout'
| 'identifyProperties'
| 'initialPresence'
| 'intents'
| 'largeThreshold'
| 'readyTimeout'
| 'token'
| 'useIdentifyCompression'
| 'version'
> {
readonly gatewayInformation: APIGatewayBotInfo;
readonly shardCount: number;
@@ -33,20 +38,20 @@ export interface IContextFetchingStrategy {
}
export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise<FetchingStrategyOptions> {
const {
buildIdentifyThrottler,
buildStrategy,
retrieveSessionInfo,
updateSessionInfo,
shardCount,
shardIds,
rest,
...managerOptions
} = manager.options;
return {
...managerOptions,
compression: manager.options.compression,
encoding: manager.options.encoding,
handshakeTimeout: manager.options.handshakeTimeout,
helloTimeout: manager.options.helloTimeout,
identifyProperties: manager.options.identifyProperties,
initialPresence: manager.options.initialPresence,
intents: manager.options.intents,
largeThreshold: manager.options.largeThreshold,
readyTimeout: manager.options.readyTimeout,
token: manager.token,
useIdentifyCompression: manager.options.useIdentifyCompression,
version: manager.options.version,
gatewayInformation: await manager.fetchGatewayInformation(),
shardCount: await manager.getShardCount(),
};