Update index.ts

This commit is contained in:
Slara 2025-07-26 21:26:34 +02:00 • committed by GitHub
parent ecb82133de
commit 62ed990f5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,2 +1,33 @@
// If Vmuser won't delete this.. ..
// Improved version from Vencore.
import { findByStoreName, findByProps } from "@vendetta/metro";
import { after, instead } from "@vendetta/patcher";
const NSFWStuff = findByProps("isNSFWInvite");
const UserStore = findByStoreName("UserStore");
let patches = [];
export default {
onLoad: () => {
patches.push(instead("handleNSFWGuildInvite", NSFWStuff, () => false));
patches.push(instead("isNSFWInvite", NSFWStuff, () => false));
patches.push(instead("shouldNSFWGateGuild", NSFWStuff, () => false));
// User store patch to modify nsfwAllowed property
patches.push(after("getCurrentUser", UserStore, (_, user) => {
if (user?.hasOwnProperty("nsfwAllowed")) {
user.nsfwAllowed = true;
}
if (user?.hasOwnProperty("ageVerificationStatus")) {
user.ageVerificationStatus = 3; // VERIFIED_ADULT
}
return user;
}));
},
onUnload: () => {
for (const unpatch of patches) {
unpatch();
}
patches = [];
}
};