From 557fdcfc6020292fec1a2aca0889b95231c01aa1 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:01:06 -0400 Subject: [PATCH] Fix Formatting --- README.md | 3 +- src/equicordplugins/noOnboarding/index.tsx | 100 +++++++++++---------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 0562fef0..428f17c7 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - NoMirroredCamera by Nyx - NoModalAnimation by AutumnVN - NoNitroUpsell by thororen +- NoOnboarding by omaw & Glitch - NoRoleHeaders by Samwich - NotificationTitle by Kyuuhachi - OnePingPerDM by ProffDea @@ -126,7 +127,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - QuestCompleter by Amia - QuestionMarkReplacement by nyx - Quoter by Samwich -- RandomVoice by xijexo & omaw +- RandomVoice by xijexo, omaw, thororen - Remix by MrDiamond - RemixMe by kvba - RepeatMessage by Tolgchu diff --git a/src/equicordplugins/noOnboarding/index.tsx b/src/equicordplugins/noOnboarding/index.tsx index dc29f23e..f01c7127 100644 --- a/src/equicordplugins/noOnboarding/index.tsx +++ b/src/equicordplugins/noOnboarding/index.tsx @@ -1,56 +1,62 @@ -import definePlugin from "@utils/types"; +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import { Devs, EquicordDevs } from "@utils/constants"; +import definePlugin from "@utils/types"; import { RestAPI } from "@webpack/common"; export default definePlugin({ name: "NoOnboarding", description: "Bypasses Discord's onboarding process for quicker server entry.", authors: [EquicordDevs.omaw, Devs.Glitch], - patches: [ - { - find: ",acceptInvite(", - replacement: { - match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!=.+?;/, - replace: (m, guildId) => `${m}$self.bypassOnboard(${guildId});` - } - }, - { - find: "{joinGuild:", - replacement: { - match: /guildId:(\i),lurker:(\i).{0,20}}\)\);/, - replace: (m, guildId, lurker) => `${m}if(!${lurker})$self.bypassOnboard(${guildId});` - } + patches: [ + { + find: ",acceptInvite(", + replacement: { + match: /INVITE_ACCEPT_SUCCESS.+?,(\i)=null!=.+?;/, + replace: (m, guildId) => `${m}$self.bypassOnboard(${guildId});` } - ], - bypassOnboard(guild_id: string) { - RestAPI.get({ url: `/guilds/${guild_id}/onboarding` }).then(res => { - const data = res.body; - if (!data?.prompts?.length) return; - - const now = Math.floor(Date.now() / 1000); - const prompts_seen: Record = {}; - const responses_seen: Record = {}; - const responses: string[] = []; - - for (const prompt of data.prompts) { - const options = prompt.options || []; - if (!options.length) continue; - prompts_seen[prompt.id] = now; - for (const opt of options) responses_seen[opt.id] = now; - responses.push(options[options.length - 1].id); - } - - const payload = { - onboarding_responses: responses, - onboarding_prompts_seen: prompts_seen, - onboarding_responses_seen: responses_seen, - }; - - RestAPI.post({ - url: `/guilds/${guild_id}/onboarding-responses`, - body: payload - }).catch(() => {}); - }).catch(() => {}); - } - }); + }, + { + find: "{joinGuild:", + replacement: { + match: /guildId:(\i),lurker:(\i).{0,20}}\)\);/, + replace: (m, guildId, lurker) => `${m}if(!${lurker})$self.bypassOnboard(${guildId});` + } + } + ], + bypassOnboard(guild_id: string) { + RestAPI.get({ url: `/guilds/${guild_id}/onboarding` }).then(res => { + const data = res.body; + if (!data?.prompts?.length) return; + + const now = Math.floor(Date.now() / 1000); + const prompts_seen: Record = {}; + const responses_seen: Record = {}; + const responses: string[] = []; + + for (const prompt of data.prompts) { + const options = prompt.options || []; + if (!options.length) continue; + prompts_seen[prompt.id] = now; + for (const opt of options) responses_seen[opt.id] = now; + responses.push(options[options.length - 1].id); + } + + const payload = { + onboarding_responses: responses, + onboarding_prompts_seen: prompts_seen, + onboarding_responses_seen: responses_seen, + }; + + RestAPI.post({ + url: `/guilds/${guild_id}/onboarding-responses`, + body: payload + }).catch(() => { }); + }).catch(() => { }); + } +});