Update Client.js

This commit is contained in:
Elysia 2024-01-25 23:39:29 +07:00
parent 4e909fd889
commit b19c7bc083

View File

@ -545,33 +545,35 @@ class Client extends BaseClient {
this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Joined`); this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Joined`);
// Guild // Guild
if (i.guild?.id) { if (i.guild?.id) {
const onboardingData = await this.api.guilds[i.guild?.id].onboarding.get(); if (options.bypassOnboarding) {
// Onboarding const onboardingData = await this.api.guilds[i.guild?.id].onboarding.get();
if (onboardingData.enabled && options.bypassOnboarding) { // Onboarding
const prompts = onboardingData.prompts.filter(o => o.in_onboarding); if (onboardingData.enabled) {
if (prompts.length) { const prompts = onboardingData.prompts.filter(o => o.in_onboarding);
const onboarding_prompts_seen = {}; if (prompts.length) {
const onboarding_responses = []; const onboarding_prompts_seen = {};
const onboarding_responses_seen = {}; const onboarding_responses = [];
const onboarding_responses_seen = {};
const currentDate = Date.now(); const currentDate = Date.now();
prompts.forEach(prompt => { prompts.forEach(prompt => {
onboarding_prompts_seen[prompt.id] = currentDate; onboarding_prompts_seen[prompt.id] = currentDate;
if (prompt.required) onboarding_responses.push(prompt.options[0].id); if (prompt.required) onboarding_responses.push(prompt.options[0].id);
prompt.options.forEach(option => { prompt.options.forEach(option => {
onboarding_responses_seen[option.id] = currentDate; onboarding_responses_seen[option.id] = currentDate;
});
}); });
});
await this.api.guilds[i.guild?.id]['onboarding-responses'].post({ await this.api.guilds[i.guild?.id]['onboarding-responses'].post({
data: { data: {
onboarding_prompts_seen, onboarding_prompts_seen,
onboarding_responses, onboarding_responses,
onboarding_responses_seen, onboarding_responses_seen,
}, },
}); });
this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Bypassed onboarding`); this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Bypassed onboarding`);
}
} }
} }
// Read rule // Read rule