diff options
author | carince <99774021+carince@users.noreply.github.com> | 2023-04-28 10:03:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 02:03:38 +0000 |
commit | 0cc3901e4e1d3f98b44a502ea927703dd336c277 (patch) | |
tree | ddec219b97bbfabd64e024e0811910348851d2ea | |
parent | f8ace5b53a9450d4b2f05c687960a93c1145cfb5 (diff) | |
download | Vencord-0cc3901e4e1d3f98b44a502ea927703dd336c277.tar.gz Vencord-0cc3901e4e1d3f98b44a502ea927703dd336c277.tar.bz2 Vencord-0cc3901e4e1d3f98b44a502ea927703dd336c277.zip |
MuteNewGuilds: add toggles for guild, everyone, and roles. (#979)
Co-authored-by: V <vendicated@riseup.net>
Co-authored-by: Norikiru <99774021+Norikiru@users.noreply.github.com>
-rw-r--r-- | src/plugins/muteNewGuild.tsx | 32 | ||||
-rw-r--r-- | src/utils/constants.ts | 4 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/plugins/muteNewGuild.tsx b/src/plugins/muteNewGuild.tsx index 9be1a67..cf15b77 100644 --- a/src/plugins/muteNewGuild.tsx +++ b/src/plugins/muteNewGuild.tsx @@ -16,9 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { definePluginSettings } from "@api/settings"; import { Devs } from "@utils/constants"; import { ModalContent, ModalFooter, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { findByProps, findStoreLazy } from "@webpack"; import { Button, Text } from "@webpack/common"; @@ -49,10 +50,28 @@ function NoDMNotificationsModal({ modalProps }: { modalProps: ModalProps; }) { ); } +const settings = definePluginSettings({ + guild: { + description: "Mute Guild", + type: OptionType.BOOLEAN, + default: true + }, + everyone: { + description: "Suppress @everyone and @here", + type: OptionType.BOOLEAN, + default: true + }, + role: { + description: "Suppress All Role @mentions", + type: OptionType.BOOLEAN, + default: true + }, +}); + export default definePlugin({ name: "MuteNewGuild", description: "Mutes newly joined guilds", - authors: [Devs.Glitch, Devs.Nuckyz], + authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince], patches: [ { find: ",acceptInvite:function", @@ -62,10 +81,17 @@ export default definePlugin({ } } ], + settings, handleMute(guildId: string | null) { if (guildId === "@me" || guildId === "null" || guildId == null) return; - findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId, { muted: true, suppress_everyone: true, suppress_roles: true }); + findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId, + { + muted: settings.store.guild, + suppress_everyone: settings.store.everyone, + suppress_roles: settings.store.role + } + ); }, start() { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index d9d1067..69eb604 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -277,5 +277,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({ KannaDev: { name: "Kanna", id: 317728561106518019n + }, + carince: { + name: "carince", + id: 818323528755314698n } }); |