From b19c7bc083fda02535793e03be0f7e7a022cf67c Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:39:29 +0700 Subject: [PATCH] Update Client.js --- src/client/Client.js | 48 +++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 6b95378..fd66005 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -545,33 +545,35 @@ class Client extends BaseClient { this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Joined`); // Guild if (i.guild?.id) { - const onboardingData = await this.api.guilds[i.guild?.id].onboarding.get(); - // Onboarding - if (onboardingData.enabled && options.bypassOnboarding) { - const prompts = onboardingData.prompts.filter(o => o.in_onboarding); - if (prompts.length) { - const onboarding_prompts_seen = {}; - const onboarding_responses = []; - const onboarding_responses_seen = {}; + if (options.bypassOnboarding) { + const onboardingData = await this.api.guilds[i.guild?.id].onboarding.get(); + // Onboarding + if (onboardingData.enabled) { + const prompts = onboardingData.prompts.filter(o => o.in_onboarding); + if (prompts.length) { + const onboarding_prompts_seen = {}; + const onboarding_responses = []; + const onboarding_responses_seen = {}; - const currentDate = Date.now(); + const currentDate = Date.now(); - prompts.forEach(prompt => { - onboarding_prompts_seen[prompt.id] = currentDate; - if (prompt.required) onboarding_responses.push(prompt.options[0].id); - prompt.options.forEach(option => { - onboarding_responses_seen[option.id] = currentDate; + prompts.forEach(prompt => { + onboarding_prompts_seen[prompt.id] = currentDate; + if (prompt.required) onboarding_responses.push(prompt.options[0].id); + prompt.options.forEach(option => { + onboarding_responses_seen[option.id] = currentDate; + }); }); - }); - await this.api.guilds[i.guild?.id]['onboarding-responses'].post({ - data: { - onboarding_prompts_seen, - onboarding_responses, - onboarding_responses_seen, - }, - }); - this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Bypassed onboarding`); + await this.api.guilds[i.guild?.id]['onboarding-responses'].post({ + data: { + onboarding_prompts_seen, + onboarding_responses, + onboarding_responses_seen, + }, + }); + this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Bypassed onboarding`); + } } } // Read rule