diff --git a/packages/discord-types/src/common/Channel.d.ts b/packages/discord-types/src/common/Channel.d.ts index 7ad5ce535..8742c9c43 100644 --- a/packages/discord-types/src/common/Channel.d.ts +++ b/packages/discord-types/src/common/Channel.d.ts @@ -71,6 +71,7 @@ export class Channel extends DiscordRecord { isGroupDM(): boolean; isGuildStageVoice(): boolean; isGuildVoice(): boolean; + isGuildVocal(): boolean; isListenModeCapable(): boolean; isManaged(): boolean; isMultiUserDM(): boolean; diff --git a/src/components/settings/tabs/plugins/PluginModal.tsx b/src/components/settings/tabs/plugins/PluginModal.tsx index e3bea165a..59de61aa2 100644 --- a/src/components/settings/tabs/plugins/PluginModal.tsx +++ b/src/components/settings/tabs/plugins/PluginModal.tsx @@ -214,7 +214,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti {({ onMouseEnter, onMouseLeave }) => ( + + + {!Settings.ignoreResetWarning && ( )} - - {({ onMouseEnter, onMouseLeave }) => ( - - )} - + } else { + reset(); + } + }} + className={cl("confirm-reset")} + > + Confirm Reset + diff --git a/src/components/settings/tabs/plugins/index.tsx b/src/components/settings/tabs/plugins/index.tsx index 273a8731e..120684092 100644 --- a/src/components/settings/tabs/plugins/index.tsx +++ b/src/components/settings/tabs/plugins/index.tsx @@ -19,27 +19,24 @@ import "./styles.css"; import * as DataStore from "@api/DataStore"; -import { showNotice } from "@api/Notices"; -import { Settings, useSettings } from "@api/Settings"; +import { useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; -import { CogWheel, InfoIcon } from "@components/Icons"; -import { openPluginModal, SettingsTab } from "@components/settings"; -import { AddonCard } from "@components/settings/AddonCard"; +import { SettingsTab } from "@components/settings"; import { debounce } from "@shared/debounce"; import { ChangeList } from "@utils/ChangeList"; import { proxyLazy } from "@utils/lazy"; import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; -import { classes, isObjectEmpty } from "@utils/misc"; -import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal"; +import { classes } from "@utils/misc"; import { useAwaiter, useIntersection } from "@utils/react"; -import { Plugin } from "@utils/types"; import { findByPropsLazy } from "@webpack"; -import { Alerts, Button, Card, Flex, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip, useMemo } from "@webpack/common"; +import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip, useMemo } from "@webpack/common"; import { JSX } from "react"; import Plugins, { ExcludedPlugins, PluginMeta } from "~plugins"; +import { PluginCard } from "./PluginCard"; +import { openWarningModal } from "./PluginModal"; import { StockPluginsCard, UserPluginsCard } from "./PluginStatCards"; // Avoid circular dependency @@ -62,7 +59,7 @@ function showErrorToast(message: string) { }); } -function ReloadRequiredCard({ required, enabledPlugins, openDisablePluginsModal, resetCheckAndDo }) { +function ReloadRequiredCard({ required, enabledPlugins, openWarningModal, resetCheckAndDo }) { return ( {required ? ( @@ -85,11 +82,9 @@ function ReloadRequiredCard({ required, enabledPlugins, openDisablePluginsModal, {enabledPlugins.length > 0 && !required && ( - } - /> - ); -} - const enum SearchStatus { ALL, ENABLED, @@ -387,81 +300,6 @@ export default function PluginSettings() { } } - function openDisablePluginsModal(enabledPlugins: String[], resetCheckAndDo: () => void) { - if (Settings.ignoreResetWarning) return resetCheckAndDo(); - - openModal(warningModalProps => ( - - - Dangerous Action - - - - - - Warning - - WARNING: You are about to disable {enabledPlugins.length} plugins! - - - THIS ACTION IS IRREVERSIBLE! - - - Are you absolutely sure you want to proceed? You can always enable them back later. - - - - - - - - - {!Settings.ignoreResetWarning && ( - - )} - - {({ onMouseEnter, onMouseLeave }) => ( - - )} - - - - - - )); - } - // Code directly taken from supportHelper.tsx const isApiPlugin = (plugin: string) => plugin.endsWith("API") || Plugins[plugin].required; @@ -493,7 +331,7 @@ export default function PluginSettings() { return ( - +
{ - const sentences = msg.content.split(/(?<=\w\.)\s/); const blockedWordsArray: string[] = settings.store.blockedWords.split(", "); + const sentences = msg.content.split(/(?<=[.!?]+['")\]]*)(\s+)/); + + msg.content = sentences.map((element, i) => { + if (i % 2 === 1) return element; - msg.content = sentences.map(element => { if (!blockedWordsArray.some(word => element.toLowerCase().startsWith(word.toLocaleLowerCase()))) { return element.charAt(0).toUpperCase() + element.slice(1); } else { return element; } - }).join(" "); + }).join(""); }; export default definePlugin({ diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index 82d5805e4..ea14b24fa 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -25,8 +25,8 @@ import { CogWheel } from "@components/Icons"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Guild } from "@vencord/discord-types"; -import { findByCodeLazy, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; -import { Menu } from "@webpack/common"; +import { findByCodeLazy, findByPropsLazy, findStoreLazy, mapMangledModuleLazy } from "@webpack"; +import { ChannelStore, Menu } from "@webpack/common"; const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings"); const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(", { @@ -36,6 +36,8 @@ const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(" } }); const isOptInEnabledForGuild = findByCodeLazy(".COMMUNITY)||", ".isOptInEnabled("); +const CollapsedVoiceChannelStore = findStoreLazy("CollapsedVoiceChannelStore"); +const collapsedChannels = findByPropsLazy("toggleCollapseGuild"); const settings = definePluginSettings({ guild: { @@ -82,6 +84,11 @@ const settings = definePluginSettings({ description: "Mute Mobile Push Notifications automatically", type: OptionType.BOOLEAN, default: true + }, + voiceChannels: { + description: "Hide names in Voice channels automatically", + type: OptionType.BOOLEAN, + default: false } }); @@ -99,8 +106,22 @@ const makeContextMenuPatch: (shouldAddIcon: boolean) => NavContextMenuPatchCallb ); }; +function applyVoiceNameHidingToGuild(guildId: string) { + if (!settings.store.voiceChannels) return; + + try { + ChannelStore.getChannelIds(guildId).filter(channelId => { + const channel = ChannelStore.getChannel(channelId); + return channel.isGuildVocal() && !CollapsedVoiceChannelStore.isCollapsed(channelId); + }).forEach(id => collapsedChannels.update(id)); + } catch (error) { + console.warn("[NewGuildSettings] Error applying voice name hiding:", error); + } +} + function applyDefaultSettings(guildId: string | null) { if (guildId === "@me" || guildId === "null" || guildId == null) return; + updateGuildNotificationSettings(guildId, { muted: settings.store.guild, @@ -110,15 +131,21 @@ function applyDefaultSettings(guildId: string | null) { 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); } + + if (settings.store.voiceChannels) { + applyVoiceNameHidingToGuild(guildId); + } } export default definePlugin({ diff --git a/src/plugins/onePingPerDM/index.ts b/src/plugins/onePingPerDM/index.ts index aeb48f1dc..ff6428953 100644 --- a/src/plugins/onePingPerDM/index.ts +++ b/src/plugins/onePingPerDM/index.ts @@ -36,6 +36,12 @@ const settings = definePluginSettings({ description: "User IDs (comma + space) whose pings should NEVER be throttled", restartNeeded: true, default: "" + }, + alwaysPlaySound: { + type: OptionType.BOOLEAN, + description: "Play message sound even when message sound is disabled", + restartNeeded: true, + default: false } }); @@ -49,16 +55,19 @@ export default definePlugin({ find: ".getDesktopType()===", replacement: [ { - match: /(\i\.\i\.getDesktopType\(\)===\i\.\i\.NEVER)\)/, - replace: "$&if(!$self.isPrivateChannelRead(arguments[0]?.message))return;else " + match: /(\i\.\i\.getDesktopType\(\)===\i\.\i\.NEVER)\)(?=.*?(\i\.\i\.playNotificationSound\(.{0,5}\)))/, + replace: "$&if(!$self.isPrivateChannelRead(arguments[0]?.message))return;else if($self.playSound())return $2;else " }, { - match: /sound:(\i\?\i:void 0,volume:\i,onClick)/, - replace: "sound:!$self.isPrivateChannelRead(arguments[0]?.message)?undefined:$1" + match: /sound:(\i\?(\i):void 0,volume:\i,onClick)/, + replace: "sound:!$self.isPrivateChannelRead(arguments[0]?.message)?undefined:$self.playSound()?$2:$1" } ] } ], + playSound() { + return settings.store.alwaysPlaySound; + }, isPrivateChannelRead(message: MessageJSON) { const ignoreList = settings.store.ignoreUsers.split(", ").filter(Boolean); if (ignoreList.includes(message.author.id)) return true;