diff --git a/src/equicordplugins/equicordHelper/index.tsx b/src/equicordplugins/equicordHelper/index.tsx index 3c6bb883f..0cf7b4841 100644 --- a/src/equicordplugins/equicordHelper/index.tsx +++ b/src/equicordplugins/equicordHelper/index.tsx @@ -6,8 +6,9 @@ import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands"; import { HeaderBarButton } from "@api/HeaderBar"; +import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents"; import { isPluginEnabled } from "@api/PluginManager"; -import { definePluginSettings } from "@api/Settings"; +import { definePluginSettings, migratePluginToSettings } from "@api/Settings"; import customRPC from "@plugins/customRPC"; import { Devs, EquicordDevs, GUILD_ID, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_IDS } from "@utils/constants"; import { isAnyPluginDev } from "@utils/misc"; @@ -20,6 +21,9 @@ import { ComponentType } from "react"; import { PluginButtons } from "./pluginButtons"; import { PluginCards } from "./pluginCards"; +migratePluginToSettings(true, "EquicordHelper", "NoBulletPoints", "noBulletPoints"); +migratePluginToSettings(true, "EquicordHelper", "NoModalAnimation", "noModalAnimation"); + let clicked = false; const SafetyHubStore = findStoreLazy("SafetyHubStore"); @@ -58,6 +62,11 @@ function StandingButton() { ); } +const listener = async (channelId, msg) => { + if (!settings.store.noBulletPoints) return; + msg.content = textProcessing(msg.content); +}; + const settings = definePluginSettings({ noMirroredCamera: { type: OptionType.BOOLEAN, @@ -106,12 +115,34 @@ const settings = definePluginSettings({ restartNeeded: true, default: false }, + noBulletPoints: { + type: OptionType.BOOLEAN, + description: "Stops you from typing markdown bullet points (stinky)", + restartNeeded: true, + default: false + }, + noModalAnimation: { + type: OptionType.BOOLEAN, + description: "Remove the 300ms long animation when opening or closing modals", + restartNeeded: true, + default: false + }, }); export default definePlugin({ name: "EquicordHelper", description: "Used to provide support, fix discord caused crashes, and other misc features.", - authors: [Devs.thororen, EquicordDevs.nyx, EquicordDevs.Naibuu, EquicordDevs.keircn, EquicordDevs.SerStars, EquicordDevs.mart, EquicordDevs.omaw], + authors: [ + Devs.thororen, + EquicordDevs.nyx, + EquicordDevs.Naibuu, + EquicordDevs.keircn, + EquicordDevs.SerStars, + EquicordDevs.mart, + EquicordDevs.omaw, + Devs.Samwich, + Devs.AutumnVN + ], required: true, settings, headerBarButton: { @@ -199,13 +230,49 @@ export default definePlugin({ }, // Restore File Download Button { - predicate: () => settings.store.restoreFileDownloadButton, find: '"VISUAL_PLACEHOLDER":', + predicate: () => settings.store.restoreFileDownloadButton, replacement: { match: /(\.downloadUrl,showDownload:)\i/, replace: "$1!0" } }, + // Removes Modal Animation + { + find: "DURATION_IN:", + predicate: () => settings.store.noModalAnimation, + replacement: { + match: /300,/, + replace: "0,", + } + }, + // Removes Modal Animation + { + find: 'backdropFilter:"blur(0px)"', + predicate: () => settings.store.noModalAnimation, + replacement: { + match: /\?0:200/, + replace: "?0:0", + } + }, + // Removes Modal Animation + { + find: '="ABOVE"', + predicate: () => settings.store.noModalAnimation, + replacement: { + match: /\?\?300/, + replace: "??0", + } + }, + // Removes Modal Animation + { + find: "renderLurkerModeUpsellPopout,position:", + predicate: () => settings.store.noModalAnimation, + replacement: { + match: /200:300/g, + replace: "0:0", + }, + } ], renderMessageAccessory(props) { return ( @@ -255,5 +322,19 @@ export default definePlugin({ } } } - ] + ], + start() { + if (settings.store.noBulletPoints) { + addMessagePreSendListener(listener); + } + }, + stop() { + if (settings.store.noBulletPoints) { + removeMessagePreSendListener(listener); + } + } }); + +function textProcessing(text: string): string { + return text.replace(/(^|\n)(\s*)([*+-])\s+/g, "$1$2\\$3 "); +} diff --git a/src/equicordplugins/moreUserTags/index.tsx b/src/equicordplugins/moreUserTags/index.tsx index 4889178e0..c15bb5e39 100644 --- a/src/equicordplugins/moreUserTags/index.tsx +++ b/src/equicordplugins/moreUserTags/index.tsx @@ -6,6 +6,7 @@ import "./styles.css"; +import { migratePluginToSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants"; import { classNameFactory } from "@utils/css"; import { getCurrentChannel, getIntlMessage } from "@utils/discord"; @@ -31,10 +32,12 @@ const genTagTypes = () => { return obj; }; +migratePluginToSettings(true, "MoreUserTags", "NoAppsAllowed", "noAppsAllowed"); + export default definePlugin({ name: "MoreUserTags", description: "Adds tags for webhooks and moderative roles (owner, admin, etc.)", - authors: [Devs.Cyn, Devs.TheSun, Devs.RyanCaoDev, Devs.LordElias, Devs.AutumnVN, EquicordDevs.Hen], + authors: [Devs.Cyn, Devs.TheSun, Devs.RyanCaoDev, Devs.LordElias, Devs.AutumnVN, EquicordDevs.Hen, EquicordDevs.meowabyte], settings, patches: [ // Make discord actually use our tags @@ -51,6 +54,14 @@ export default definePlugin({ predicate: () => settings.store.dontShowBotTag }, ], + }, + { + find: '"#{intl::APP_TAG::hash}":', + predicate: () => settings.store.noAppsAllowed, + replacement: { + match: /(#{intl::APP_TAG::hash}":\[").*?("\])/, + replace: "$1BOT$2" + } } ], start() { diff --git a/src/equicordplugins/moreUserTags/settings.tsx b/src/equicordplugins/moreUserTags/settings.tsx index a9be8ed83..23aa28cc1 100644 --- a/src/equicordplugins/moreUserTags/settings.tsx +++ b/src/equicordplugins/moreUserTags/settings.tsx @@ -115,4 +115,10 @@ export const settings = definePluginSettings({ component: SettingsComponent, description: "fill me" }, + noAppsAllowed: { + description: "Replaces app for bot", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true + } }); diff --git a/src/equicordplugins/noAppsAllowed/index.ts b/src/equicordplugins/noAppsAllowed/index.ts deleted file mode 100644 index 91e03dd5c..000000000 --- a/src/equicordplugins/noAppsAllowed/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { EquicordDevs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "NoAppsAllowed", - description: "returns the bot's tag :skulk:", - authors: [EquicordDevs.meowabyte], - patches: [ - { - find: '"#{intl::APP_TAG::hash}":', - replacement: { - match: /(#{intl::APP_TAG::hash}":\[").*?("\])/, - replace: "$1BOT$2" - } - } - ] -}); diff --git a/src/equicordplugins/noBulletPoints/index.tsx b/src/equicordplugins/noBulletPoints/index.tsx deleted file mode 100644 index cedd4226c..000000000 --- a/src/equicordplugins/noBulletPoints/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; -export default definePlugin({ - name: "NoBulletPoints", - description: "Stops you from typing markdown bullet points (stinky)", - authors: [Devs.Samwich], - onBeforeMessageSend(channelId, msg) { - msg.content = textProcessing(msg.content); - }, -}); - -function textProcessing(text: string): string { - return text.replace(/(^|\n)(\s*)([*+-])\s+/g, "$1$2\\$3 "); -} diff --git a/src/equicordplugins/noModalAnimation/index.ts b/src/equicordplugins/noModalAnimation/index.ts deleted file mode 100644 index b86bb95b3..000000000 --- a/src/equicordplugins/noModalAnimation/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "NoModalAnimation", - description: "Remove the 300ms long animation when opening or closing modals", - authors: [Devs.AutumnVN], - patches: [ - { - find: "DURATION_IN:", - replacement: { - match: /300,/, - replace: "0,", - } - }, - { - find: 'backdropFilter:"blur(0px)"', - replacement: { - match: /\?0:200/, - replace: "?0:0", - } - }, - { - find: '="ABOVE"', - replacement: { - match: /\?\?300/, - replace: "??0", - } - }, - { - find: "renderLurkerModeUpsellPopout,position:", - replacement: { - match: /200:300/g, - replace: "0:0", - }, - } - ] -}); diff --git a/src/plugins/fixYoutubeEmbeds.desktop/index.ts b/src/plugins/fixYoutubeEmbeds.desktop/index.ts deleted file mode 100644 index 55486d763..000000000 --- a/src/plugins/fixYoutubeEmbeds.desktop/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "FixYoutubeEmbeds", - description: "Bypasses youtube videos being blocked from display on Discord (for example by UMG)", - authors: [Devs.coolelectronics] -}); diff --git a/src/equicordplugins/youtubeDescription/index.tsx b/src/plugins/fixYoutubeEmbeds.desktop/index.tsx similarity index 68% rename from src/equicordplugins/youtubeDescription/index.tsx rename to src/plugins/fixYoutubeEmbeds.desktop/index.tsx index 4b2072893..6ea46fd7f 100644 --- a/src/equicordplugins/youtubeDescription/index.tsx +++ b/src/plugins/fixYoutubeEmbeds.desktop/index.tsx @@ -1,24 +1,38 @@ /* * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors + * Copyright (c) 2023 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ +import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { Embed } from "@vencord/discord-types"; import { useState } from "@webpack/common"; interface ToggleableDescriptionProps { embed: Embed, original: () => any; } +const settings = definePluginSettings({ + youtubeDescription: { + description: "Adds descriptions to youtube video embeds", + type: OptionType.BOOLEAN, + default: false, + restartNeeded: true + } +}); + +migratePluginSettings("FixYoutubeEmbeds", "YoutubeDescription"); + export default definePlugin({ - name: "YoutubeDescription", - description: "Adds descriptions to youtube video embeds", - authors: [Devs.arHSM], + name: "FixYoutubeEmbeds", + description: "Bypasses youtube videos being blocked from display on Discord (for example by UMG)", + authors: [Devs.coolelectronics, Devs.arHSM], + settings, patches: [ { find: "#{intl::SUPPRESS_ALL_EMBEDS}", + predicate: () => settings.store.youtubeDescription, replacement: { match: /case (\i\.\i\.VIDEO):(case \i\.\i\.\i:)*break;default:(\i)=(?:(this\.renderDescription)\(\))\}/, replace: "$2 break; case $1: $3 = $self.ToggleableDescriptionWrapper({ embed: this.props.embed, original: $4.bind(this) }); break; default: $3 = $4() }"