fix: intents can be number[] now

This commit is contained in:
MARCROCK22 2024-03-26 13:38:08 -04:00
parent 28fb9b8cda
commit 168aab508a
2 changed files with 9 additions and 2 deletions

View File

@ -296,7 +296,11 @@ export type RuntimeConfigHTTP = Omit<MakeRequired<RC, 'publicKey' | 'application
}; };
export type InternalRuntimeConfig = Omit<MakeRequired<RC, 'intents'>, 'publicKey' | 'port'>; export type InternalRuntimeConfig = Omit<MakeRequired<RC, 'intents'>, 'publicKey' | 'port'>;
export type RuntimeConfig = OmitInsert<InternalRuntimeConfig, 'intents', { intents?: IntentStrings | number }>; export type RuntimeConfig = OmitInsert<
InternalRuntimeConfig,
'intents',
{ intents?: IntentStrings | number[] | number }
>;
export interface ServicesOptions { export interface ServicesOptions {
rest?: ApiHandler; rest?: ApiHandler;

View File

@ -68,7 +68,10 @@ export const config = {
'intents' in data 'intents' in data
? typeof data.intents === 'number' ? typeof data.intents === 'number'
? data.intents ? data.intents
: data.intents?.reduce((pr, acc) => pr | GatewayIntentBits[acc], 0) ?? 0 : data.intents?.reduce<number>(
(pr, acc) => pr | (typeof acc === 'number' ? acc : GatewayIntentBits[acc]),
0,
) ?? 0
: 0, : 0,
} as InternalRuntimeConfig; } as InternalRuntimeConfig;
}, },