Fix Formatting

This commit is contained in:
thororen1234 2025-04-23 18:01:06 -04:00
parent 5195317cc4
commit 557fdcfc60
No known key found for this signature in database
2 changed files with 55 additions and 48 deletions

View file

@ -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

View file

@ -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});`
}
},
{
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<string, number> = {};
const responses_seen: Record<string, number> = {};
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(() => {});
}
});
],
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<string, number> = {};
const responses_seen: Record<string, number> = {};
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(() => { });
}
});