From 4c67ea348224776a695a7119e262de732008100b Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Wed, 18 May 2022 16:34:31 +0000 Subject: [PATCH] fix: make intents and events optional --- bot.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.ts b/bot.ts index f1810a719..29a54bb84 100644 --- a/bot.ts +++ b/bot.ts @@ -144,8 +144,8 @@ export function createBot(options: CreateBotOptions): Bot { id: options.botId, applicationId: options.applicationId || options.botId, token: removeTokenPrefix(options.token), - events: createEventHandlers(options.events), - intents: options.intents.reduce( + events: createEventHandlers(options.events ?? {}), + intents: (options.intents ?? []).reduce( (bits, next) => (bits |= GatewayIntents[next]), 0, ), @@ -163,7 +163,7 @@ export function createBot(options: CreateBotOptions): Bot { }, rest: createRestManager({ token: options.token, - debug: options.events.debug, + debug: options.events?.debug, secretKey: options.secretKey ?? undefined, }), } as Bot; @@ -317,8 +317,8 @@ export interface CreateBotOptions { botId: bigint; applicationId?: bigint; secretKey?: string; - events: Partial; - intents: (keyof typeof GatewayIntents)[]; + events?: Partial; + intents?: (keyof typeof GatewayIntents)[]; botGatewayData?: GetGatewayBot; rest?: Omit; handleDiscordPayload?: GatewayManager["handleDiscordPayload"];