diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx
index 5ebca1f8..cacdba5f 100644
--- a/src/plugins/betterNotes/index.tsx
+++ b/src/plugins/betterNotes/index.tsx
@@ -61,7 +61,7 @@ export default definePlugin({
find: ".popularApplicationCommandIds,",
replacement: {
match: /lastSection:(!?\i)}\),/,
- replace: "$&$self.patchPadding($1),"
+ replace: "$&$self.patchPadding({lastSection:$1}),"
}
}
],
@@ -81,12 +81,10 @@ export default definePlugin({
}
},
- patchPadding(lastSection: any) {
- if (!lastSection) return;
+ patchPadding: ErrorBoundary.wrap(({ lastSection }) => {
+ if (!lastSection) return null;
return (
-
-
-
+
);
- }
+ })
});
diff --git a/src/plugins/pauseInvitesForever/index.tsx b/src/plugins/pauseInvitesForever/index.tsx
index 1e71a4ed..e7abaa17 100644
--- a/src/plugins/pauseInvitesForever/index.tsx
+++ b/src/plugins/pauseInvitesForever/index.tsx
@@ -24,6 +24,22 @@ import { GuildStore, i18n, RestAPI } from "@webpack/common";
const { InvitesDisabledExperiment } = findByPropsLazy("InvitesDisabledExperiment");
+function showDisableInvites(guildId: string) {
+ // Once the experiment is removed, this should keep working
+ const { enableInvitesDisabled } = InvitesDisabledExperiment?.getCurrentConfig?.({ guildId }) ?? { enableInvitesDisabled: true };
+ // @ts-ignore
+ return enableInvitesDisabled && !GuildStore.getGuild(guildId).hasFeature("INVITES_DISABLED");
+}
+
+function disableInvites(guildId: string) {
+ const guild = GuildStore.getGuild(guildId);
+ const features = [...guild.features, "INVITES_DISABLED"];
+ RestAPI.patch({
+ url: `/guilds/${guild.id}`,
+ body: { features },
+ });
+}
+
export default definePlugin({
name: "PauseInvitesForever",
tags: ["DisableInvitesForever"],
@@ -33,44 +49,29 @@ export default definePlugin({
patches: [
{
find: "Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION",
- replacement: [{
- match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/,
- replace: "children: $self.renderInvitesLabel(arguments[0].guildId, setChecked)",
- },
- {
- match: /(\i\.hasDMsDisabled\)\(\i\),\[\i,(\i)\]=\i\.useState\(\i\))/,
- replace: "$1,setChecked=$2"
- }]
+ group: true,
+ replacement: [
+ {
+ match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/,
+ replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
+ },
+ {
+ match: /(\i\.hasDMsDisabled\)\(\i\),\[\i,(\i)\]=\i\.useState\(\i\))/,
+ replace: "$1,setChecked=$2"
+ }
+ ]
}
],
- showDisableInvites(guildId: string) {
- // Once the experiment is removed, this should keep working
- const { enableInvitesDisabled } = InvitesDisabledExperiment?.getCurrentConfig?.({ guildId }) ?? { enableInvitesDisabled: true };
- // @ts-ignore
- return enableInvitesDisabled && !GuildStore.getGuild(guildId).hasFeature("INVITES_DISABLED");
- },
-
- disableInvites(guildId: string) {
- const guild = GuildStore.getGuild(guildId);
- const features = [...guild.features, "INVITES_DISABLED"];
- RestAPI.patch({
- url: `/guilds/${guild.id}`,
- body: { features },
- });
- },
-
- renderInvitesLabel(guildId: string, setChecked: Function) {
+ renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => {
return (
-
-
-
+
);
- }
+ })
});