Plugin

PauseInvitesForever

Brings back the option to pause invites indefinitely that stupit Discord removed.

Servers
index.tsx
Download

Source

src/plugins/pauseInvitesForever/index.tsx
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import ErrorBoundary from "@components/ErrorBoundary";
8import { Devs } from "@utils/constants";
9import { getIntlMessage, hasGuildFeature } from "@utils/discord";
10import definePlugin from "@utils/types";
11import { Constants, GuildStore, PermissionStore, RestAPI } from "@webpack/common";
12
13function showDisableInvites(guildId: string) {
14 const guild = GuildStore.getGuild(guildId);
15 if (!guild) return false;
16
17 return (
18 !hasGuildFeature(guild, "INVITES_DISABLED") &&
19 PermissionStore.getGuildPermissionProps(guild).canManageRoles
20 );
21}
22
23function disableInvites(guildId: string) {
24 const guild = GuildStore.getGuild(guildId);
25 const features = [...guild.features, "INVITES_DISABLED"];
26 RestAPI.patch({
27 url: Constants.Endpoints.GUILD(guildId),
28 body: { features },
29 });
30}
31
32export default definePlugin({
33 name: "PauseInvitesForever",
34 searchTerms: ["DisableInvitesForever"],
35 description: "Brings back the option to pause invites indefinitely that stupit Discord removed.",
36 tags: ["Servers"],
37 authors: [Devs.Dolfies, Devs.amia],
38
39 patches: [
40 {
41 find: "#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}",
42 group: true,
43 replacement: [
44 {
45 match: /children:\i\.\i\.string\(\i\.\i#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}\)/,
46 replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
47 },
48 {
49 match: /\.INVITES_DISABLED\)(?=.+?#{intl::INVITES_PERMANENTLY_DISABLED_TIP}.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
50 replace: "$&,setChecked=$2"
51 }
52 ]
53 }
54 ],
55
56 renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => {
57 return (
58 <div>
59 {getIntlMessage("GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION")}
60 {showDisableInvites(guildId) && <a role="button" onClick={() => {
61 setChecked(true);
62 disableInvites(guildId);
63 }}> Pause Indefinitely.</a>}
64 </div>
65 );
66 }, { noop: true })
67});
68