From 168aab508a2fba1dcdafc43c2865ae38494a6d92 Mon Sep 17 00:00:00 2001 From: MARCROCK22 <57925328+MARCROCK22@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:38:08 -0400 Subject: [PATCH] fix: intents can be number[] now --- src/client/base.ts | 6 +++++- src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/base.ts b/src/client/base.ts index 9806910..09a1271 100644 --- a/src/client/base.ts +++ b/src/client/base.ts @@ -296,7 +296,11 @@ export type RuntimeConfigHTTP = Omit, 'publicKey' | 'port'>; -export type RuntimeConfig = OmitInsert; +export type RuntimeConfig = OmitInsert< + InternalRuntimeConfig, + 'intents', + { intents?: IntentStrings | number[] | number } +>; export interface ServicesOptions { rest?: ApiHandler; diff --git a/src/index.ts b/src/index.ts index da1e5c1..fda7e43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -68,7 +68,10 @@ export const config = { 'intents' in data ? typeof data.intents === 'number' ? data.intents - : data.intents?.reduce((pr, acc) => pr | GatewayIntentBits[acc], 0) ?? 0 + : data.intents?.reduce( + (pr, acc) => pr | (typeof acc === 'number' ? acc : GatewayIntentBits[acc]), + 0, + ) ?? 0 : 0, } as InternalRuntimeConfig; },