From 04d7cb8797b3f15a97228c7b9f051cd7788aeb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ruiz=20P=C3=A9rez?= <57387907+GabiRP@users.noreply.github.com> Date: Sat, 4 May 2024 01:15:18 +0200 Subject: [PATCH] NewGuildSettings: add push notifs, highlights & events (#2413) Co-authored-by: V --- src/plugins/newGuildSettings/index.tsx | 34 +++++++++++++++++++++++--- src/utils/constants.ts | 4 +++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index ff6f1c261..d5c3d9206 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { definePluginSettings,migratePluginSettings } from "@api/Settings"; +import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; @@ -31,6 +31,16 @@ const settings = definePluginSettings({ type: OptionType.BOOLEAN, default: true }, + messages: { + description: "Server Notification Settings", + type: OptionType.SELECT, + options: [ + { label: "All messages", value: 0 }, + { label: "Only @mentions", value: 1 }, + { label: "Nothing", value: 2 }, + { label: "Server default", value: 3, default: true } + ], + }, everyone: { description: "Suppress @everyone and @here", type: OptionType.BOOLEAN, @@ -41,6 +51,16 @@ const settings = definePluginSettings({ type: OptionType.BOOLEAN, default: true }, + highlights: { + description: "Suppress Highlights automatically", + type: OptionType.BOOLEAN, + default: true + }, + events: { + description: "Mute New Events automatically", + type: OptionType.BOOLEAN, + default: true + }, showAllChannels: { description: "Show all channels automatically", type: OptionType.BOOLEAN, @@ -53,7 +73,7 @@ export default definePlugin({ name: "NewGuildSettings", description: "Automatically mute new servers and change various other settings upon joining", tags: ["MuteNewGuild", "mute", "server"], - authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi], + authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi, Devs.GabiRP], patches: [ { find: ",acceptInvite(", @@ -78,8 +98,16 @@ export default definePlugin({ { muted: settings.store.guild, suppress_everyone: settings.store.everyone, - suppress_roles: settings.store.role + suppress_roles: settings.store.role, + mute_scheduled_events: settings.store.events, + notify_highlights: settings.store.highlights ? 1 : 0 }); + if (settings.store.messages !== 3) { + updateGuildNotificationSettings(guildId, + { + message_notifications: settings.store.messages, + }); + } if (settings.store.showAllChannels && isOptInEnabledForGuild(guildId)) { toggleShowAllChannels(guildId); } diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 8ab0bffb3..cce276ef8 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -449,6 +449,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ PolisanTheEasyNick: { name: "Oleh Polisan", id: 242305263313485825n + }, + GabiRP: { + name: "GabiRP", + id: 507955112027750401n } } satisfies Record);