diff --git a/package.json b/package.json index dc90a646c..ac4859593 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.9.3", + "version": "1.9.4", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { diff --git a/src/components/VencordSettings/ThemesTab.tsx b/src/components/VencordSettings/ThemesTab.tsx index 016371bed..aa8761d76 100644 --- a/src/components/VencordSettings/ThemesTab.tsx +++ b/src/components/VencordSettings/ThemesTab.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { useSettings } from "@api/Settings"; +import { Settings, useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import { Flex } from "@components/Flex"; import { DeleteIcon, FolderIcon, PaintbrushIcon, PencilIcon, PlusIcon, RestartIcon } from "@components/Icons"; @@ -32,6 +32,8 @@ import { findByPropsLazy, findLazy } from "@webpack"; import { Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common"; import type { ComponentType, Ref, SyntheticEvent } from "react"; +import Plugins from "~plugins"; + import { AddonCard } from "./AddonCard"; import { QuickAction, QuickActionCard } from "./quickActions"; import { SettingsTab, wrapTab } from "./shared"; @@ -250,10 +252,10 @@ function ThemesTab() { Icon={PaintbrushIcon} /> - {Vencord.Settings.plugins.ClientTheme.enabled && ( + {Settings.plugins.ClientTheme.enabled && ( openPluginModal(Vencord.Plugins.plugins.ClientTheme)} + action={() => openPluginModal(Plugins.ClientTheme)} Icon={PencilIcon} /> )} diff --git a/src/plugins/banger/index.ts b/src/plugins/banger/index.ts index 7e0d2df73..eca80f9ee 100644 --- a/src/plugins/banger/index.ts +++ b/src/plugins/banger/index.ts @@ -16,28 +16,34 @@ * along with this program. If not, see . */ +import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; +const settings = definePluginSettings({ + source: { + description: "Source to replace ban GIF with (Video or Gif)", + type: OptionType.STRING, + default: "https://i.imgur.com/wp5q52C.mp4", + restartNeeded: true, + } +}); + export default definePlugin({ name: "BANger", description: "Replaces the GIF in the ban dialogue with a custom one.", authors: [Devs.Xinto, Devs.Glitch], + settings, patches: [ { find: "BAN_CONFIRM_TITLE.", replacement: { match: /src:\i\("?\d+"?\)/g, - replace: "src: Vencord.Settings.plugins.BANger.source" + replace: "src:$self.source" } } ], - options: { - source: { - description: "Source to replace ban GIF with (Video or Gif)", - type: OptionType.STRING, - default: "https://i.imgur.com/wp5q52C.mp4", - restartNeeded: true, - } + get source() { + return settings.store.source; } }); diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx index cacdba5fd..b97076bf4 100644 --- a/src/plugins/betterNotes/index.tsx +++ b/src/plugins/betterNotes/index.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { Settings } from "@api/Settings"; +import { definePluginSettings, Settings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { canonicalizeMatch } from "@utils/patches"; @@ -25,10 +25,26 @@ import { findByPropsLazy } from "@webpack"; const UserPopoutSectionCssClasses = findByPropsLazy("section", "lastSection"); +const settings = definePluginSettings({ + hide: { + type: OptionType.BOOLEAN, + description: "Hide notes", + default: false, + restartNeeded: true + }, + noSpellCheck: { + type: OptionType.BOOLEAN, + description: "Disable spellcheck in notes", + disabled: () => Settings.plugins.BetterNotesBox.hide, + default: false + } +}); + export default definePlugin({ name: "BetterNotesBox", description: "Hide notes or disable spellcheck (Configure in settings!!)", authors: [Devs.Ven], + settings, patches: [ { @@ -36,7 +52,7 @@ export default definePlugin({ all: true, // Some modules match the find but the replacement is returned untouched noWarn: true, - predicate: () => Vencord.Settings.plugins.BetterNotesBox.hide, + predicate: () => settings.store.hide, replacement: { match: /hideNote:.+?(?=([,}].*?\)))/g, replace: (m, rest) => { @@ -54,7 +70,7 @@ export default definePlugin({ find: "Messages.NOTE_PLACEHOLDER", replacement: { match: /\.NOTE_PLACEHOLDER,/, - replace: "$&spellCheck:!Vencord.Settings.plugins.BetterNotesBox.noSpellCheck," + replace: "$&spellCheck:!$self.noSpellCheck," } }, { @@ -66,25 +82,14 @@ export default definePlugin({ } ], - options: { - hide: { - type: OptionType.BOOLEAN, - description: "Hide notes", - default: false, - restartNeeded: true - }, - noSpellCheck: { - type: OptionType.BOOLEAN, - description: "Disable spellcheck in notes", - disabled: () => Settings.plugins.BetterNotesBox.hide, - default: false - } - }, - patchPadding: ErrorBoundary.wrap(({ lastSection }) => { if (!lastSection) return null; return (
); - }) + }), + + get noSpellCheck() { + return settings.store.noSpellCheck; + } }); diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index fdd6dc9b9..6969f0909 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -337,7 +337,7 @@ export default definePlugin({ // Pass through editHistory & deleted & original attachments to the "edited message" transformer match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/, replace: - "Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, attachments:$1.attachments })" + "Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory })" }, { diff --git a/src/plugins/messageLogger/messageLogger.css b/src/plugins/messageLogger/messageLogger.css index d5a9c5f17..a112b1961 100644 --- a/src/plugins/messageLogger/messageLogger.css +++ b/src/plugins/messageLogger/messageLogger.css @@ -8,11 +8,15 @@ .emoji, [data-type="sticker"], iframe, - .messagelogger-deleted-attachment:not([class*="hiddenAttachment_"]), + .messagelogger-deleted-attachment, [class|="inlineMediaEmbed"] ) { filter: grayscale(1) !important; transition: 150ms filter ease-in-out; + + &[class*="hiddenMosaicItem_"] { + filter: grayscale(1) blur(var(--custom-message-attachment-spoiler-blur-radius, 44px)) !important; + } } .messagelogger-deleted @@ -23,8 +27,7 @@ iframe, .messagelogger-deleted-attachment, [class|="inlineMediaEmbed"] -):hover, -.messagelogger-deleted { +):hover { filter: grayscale(0) !important; } diff --git a/src/plugins/urbanDictionary/README.md b/src/plugins/urbanDictionary/README.md deleted file mode 100644 index e065456a3..000000000 --- a/src/plugins/urbanDictionary/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Urban Dictionary - -Use /urban slash command to search for a definition for a word on [Urban Dictionary](https://www.urbandictionary.com/). - -## Preview - -![preview](https://i.imgur.com/1zwzj38.png) - -## Usage - -- Enable this plugin -- Set plugin settings as desired -- Type /urban and start getting definitions right into your Discord client. diff --git a/src/plugins/urbanDictionary/index.ts b/src/plugins/urbanDictionary/index.ts deleted file mode 100644 index 89dcdcba4..000000000 --- a/src/plugins/urbanDictionary/index.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands"; -import { ApplicationCommandInputType } from "@api/Commands/types"; -import { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -const settings = definePluginSettings({ - resultsAmount: { - type: OptionType.NUMBER, - description: "The amount of results you want to get (more gives better results, but is slower)", - default: 10 - } -}); - -export default definePlugin({ - name: "UrbanDictionary", - description: "Search for a word on Urban Dictionary via /urban slash command", - authors: [Devs.jewdev], - dependencies: ["CommandsAPI"], - settings, - commands: [ - { - name: "urban", - description: "Returns the definition of a word from Urban Dictionary", - inputType: ApplicationCommandInputType.BUILT_IN, - options: [ - { - type: ApplicationCommandOptionType.STRING, - name: "word", - description: "The word to search for on Urban Dictionary", - required: true - } - ], - execute: async (args, ctx) => { - try { - const query: string = encodeURIComponent(args[0].value); - const { list } = await fetch(`https://api.urbandictionary.com/v0/define?term=${query}&per_page=${settings.store.resultsAmount}`).then(response => response.json()); - - if (!list.length) - return void sendBotMessage(ctx.channel.id, { content: "No results found." }); - - const definition = list.reduce((prev, curr) => { - return prev.thumbs_up > curr.thumbs_up ? prev : curr; - }); - - const linkify = (text: string) => text - .replaceAll("\r\n", "\n") - .replace(/([*>_`~\\])/gsi, "\\$1") - .replace(/\[(.+?)\]/g, (_, word) => `[${word}](https://www.urbandictionary.com/define.php?term=${encodeURIComponent(word)} "Define '${word}' on Urban Dictionary")`) - .trim(); - - return void sendBotMessage(ctx.channel.id, { - embeds: [ - { - type: "rich", - author: { - name: `Uploaded by "${definition.author}"`, - url: `https://www.urbandictionary.com/author.php?author=${encodeURIComponent(definition.author)}`, - }, - title: definition.word, - url: `https://www.urbandictionary.com/define.php?term=${encodeURIComponent(definition.word)}`, - description: linkify(definition.definition), - fields: [ - { - name: "Example", - value: linkify(definition.example), - }, - { - name: "Want more definitions?", - value: `Check out [more definitions](https://www.urbandictionary.com/define.php?term=${query} "Define "${args[0].value}" on Urban Dictionary") on Urban Dictionary.`, - }, - ], - color: 0xFF9900, - footer: { text: `👍 ${definition.thumbs_up.toString()} | 👎 ${definition.thumbs_down.toString()}`, icon_url: "https://www.urbandictionary.com/favicon.ico" }, - timestamp: new Date(definition.written_on).toISOString(), - }, - ] as any, - }); - } catch (error) { - sendBotMessage(ctx.channel.id, { - content: `Something went wrong: \`${error}\``, - }); - } - } - } - ] -}); diff --git a/src/plugins/wikisearch/index.ts b/src/plugins/wikisearch/index.ts deleted file mode 100644 index 81dc37af1..000000000 --- a/src/plugins/wikisearch/index.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "Wikisearch", - description: "Searches Wikipedia for your requested query. (/wikisearch)", - authors: [Devs.Samu], - dependencies: ["CommandsAPI"], - commands: [ - { - name: "wikisearch", - description: "Searches Wikipedia for your request.", - inputType: ApplicationCommandInputType.BUILT_IN, - options: [ - { - name: "search", - description: "Word to search for", - type: ApplicationCommandOptionType.STRING, - required: true - }, - ], - execute: async (_, ctx) => { - const word = findOption(_, "search", ""); - - if (!word) { - return sendBotMessage(ctx.channel.id, { - content: "No word was defined!" - }); - } - - const dataSearchParams = new URLSearchParams({ - action: "query", - format: "json", - list: "search", - formatversion: "2", - origin: "*", - srsearch: word - }); - - const data = await fetch("https://en.wikipedia.org/w/api.php?" + dataSearchParams).then(response => response.json()) - .catch(err => { - console.log(err); - sendBotMessage(ctx.channel.id, { content: "There was an error. Check the console for more info" }); - return null; - }); - - if (!data) return; - - if (!data.query?.search?.length) { - console.log(data); - return sendBotMessage(ctx.channel.id, { content: "No results given" }); - } - - const altData = await fetch(`https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info%7Cdescription%7Cimages%7Cimageinfo%7Cpageimages&list=&meta=&indexpageids=1&pageids=${data.query.search[0].pageid}&formatversion=2&origin=*`) - .then(res => res.json()) - .then(data => data.query.pages[0]) - .catch(err => { - console.log(err); - sendBotMessage(ctx.channel.id, { content: "There was an error. Check the console for more info" }); - return null; - }); - - if (!altData) return; - - const thumbnailData = altData.thumbnail; - - const thumbnail = thumbnailData && { - url: thumbnailData.source.replace(/(50px-)/ig, "1000px-"), - height: thumbnailData.height * 100, - width: thumbnailData.width * 100 - }; - - sendBotMessage(ctx.channel.id, { - embeds: [ - { - type: "rich", - title: data.query.search[0].title, - url: `https://wikipedia.org/w/index.php?curid=${data.query.search[0].pageid}`, - color: "0x8663BE", - description: data.query.search[0].snippet.replace(/( |<([^>]+)>)/ig, "").replace(/(")/ig, "\"") + "...", - image: thumbnail, - footer: { - text: "Powered by the Wikimedia API", - }, - } - ] as any - }); - } - } - ] -});