diff --git a/README.md b/README.md index 9f3aaf56..380e341e 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - KeywordNotify by camila314 - Meow by Samwich - MessageLinkTooltip by Kyuuhachi -- MessageLoggerEnhanced (MLEnhanced) by Aria +- MessageLoggerEnhanced by Aria - noAppsAllowed by kvba - NoModalAnimation by AutumnVN - NoNitroUpsell by thororen @@ -62,12 +62,12 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - OnePingPerDM by ProffDea - PlatformSpoofer by Drag - PurgeMessages by bhop and nyx -- QuestionMarkReplacement (QuestionMarkReplace) by nyx +- Quest Completer by HappyEnderman, SerStars, thororen +- QuestionMarkReplacement by nyx - Quoter by Samwich - RepeatMessage by Tolgchu - ReplyPingControl by ant0n and MrDiamond - ScreenRecorder by AutumnVN -- Search by JacobTm and thororen - SearchFix by Jaxx - Sekai Stickers by MaiKokain - ServerSearch by camila314 diff --git a/src/components/PluginSettings/ContributorModal.tsx b/src/components/PluginSettings/ContributorModal.tsx index ff7908e6..0d21de94 100644 --- a/src/components/PluginSettings/ContributorModal.tsx +++ b/src/components/PluginSettings/ContributorModal.tsx @@ -10,7 +10,7 @@ import { useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Link } from "@components/Link"; -import { DevsById, EquicordDevsById } from "@utils/constants"; +import { EquicordDevsById, SuncordDevsById, VencordDevsById } from "@utils/constants"; import { fetchUserProfile } from "@utils/discord"; import { classes, pluralise } from "@utils/misc"; import { ModalContent, ModalRoot, openModal } from "@utils/modal"; @@ -51,8 +51,8 @@ function ContributorModal({ user }: { user: User; }) { const plugins = useMemo(() => { const allPlugins = Object.values(Plugins); - const pluginsByAuthor = DevsById[user.id] || EquicordDevsById[user.id] - ? allPlugins.filter(p => p.authors.includes(DevsById[user.id] || EquicordDevsById[user.id])) + const pluginsByAuthor = VencordDevsById[user.id] || EquicordDevsById[user.id] || SuncordDevsById[user.id] + ? allPlugins.filter(p => p.authors.includes(VencordDevsById[user.id] || EquicordDevsById[user.id]) || SuncordDevsById[user.id]) : allPlugins.filter(p => p.authors.some(a => a.name === user.username)); return pluginsByAuthor diff --git a/src/equicordplugins/discordColorways/components/ThemePreview.tsx b/src/equicordplugins/discordColorways/components/ThemePreview.tsx index 593c0b16..1833f8e9 100644 --- a/src/equicordplugins/discordColorways/components/ThemePreview.tsx +++ b/src/equicordplugins/discordColorways/components/ThemePreview.tsx @@ -1,6 +1,6 @@ /* * Vencord, a Discord client mod - * Copyright (c) 2023 Vendicated and contributors + * Copyright (c) 2024 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ diff --git a/src/equicordplugins/messageLoggerEnhanced/index.tsx b/src/equicordplugins/messageLoggerEnhanced/index.tsx index e55ca79f..54b25d08 100644 --- a/src/equicordplugins/messageLoggerEnhanced/index.tsx +++ b/src/equicordplugins/messageLoggerEnhanced/index.tsx @@ -23,7 +23,7 @@ export const Native = getNative(); import "./styles.css"; import { NavContextMenuPatchCallback } from "@api/ContextMenu"; -import { definePluginSettings, Settings } from "@api/Settings"; +import { definePluginSettings, migratePluginSettings, Settings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { Logger } from "@utils/Logger"; @@ -53,6 +53,7 @@ export const cacheSentMessages = new LimitedMap(); const cacheThing = findByPropsLazy("commit", "getOrCreate"); +let oldGetMessage: typeof MessageStore.getMessage; const handledMessageIds = new Set(); async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: boolean; }) { @@ -72,7 +73,7 @@ async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: bo handledMessageIds.add(payload.id); let message: LoggedMessage | LoggedMessageJSON | null = - MessageStore.getMessage(payload.channelId, payload.id); + oldGetMessage?.(payload.channelId, payload.id); if (message == null) { // most likely an edited message const cachedMessage = cacheSentMessages.get(`${payload.channelId},${payload.id}`); @@ -141,8 +142,7 @@ async function messageUpdateHandler(payload: MessageUpdatePayload) { return;// Flogger.log("this message has been ignored", payload); } - let message = MessageStore - .getMessage(payload.message.channel_id, payload.message.id) as LoggedMessage | LoggedMessageJSON | null; + let message = oldGetMessage?.(payload.message.channel_id, payload.message.id) as LoggedMessage | LoggedMessageJSON | null; if (message == null) { // MESSAGE_UPDATE gets dispatched when emebeds change too and content becomes null @@ -570,8 +570,9 @@ const contextMenuPath: NavContextMenuPatchCallback = (children, props) => { } }; +migratePluginSettings("MessageLoggerEnhanced", "MLEnhanced"); export default definePlugin({ - name: "MLEnhanced", + name: "MessageLoggerEnhanced", authors: [Devs.Aria], description: "G'day", dependencies: ["MessageLogger"], @@ -747,7 +748,7 @@ export default definePlugin({ }, async start() { - this.oldGetMessage = MessageStore.getMessage; + this.oldGetMessage = oldGetMessage = MessageStore.getMessage; // we have to do this because the original message logger fetches the message from the store now MessageStore.getMessage = (channelId: string, messageId: string) => { const MLMessage = LoggedMessageManager.getMessage(channelId, messageId); diff --git a/src/equicordplugins/messageLoggerEnhanced/styles.css b/src/equicordplugins/messageLoggerEnhanced/styles.css index d4a007bc..3b5987b4 100644 --- a/src/equicordplugins/messageLoggerEnhanced/styles.css +++ b/src/equicordplugins/messageLoggerEnhanced/styles.css @@ -79,4 +79,28 @@ .vc-updater-modal-content { padding: 1rem 2rem; -} \ No newline at end of file +} + +div[class*="messagelogger-deleted"] [class*="contents"] > :is(div, h1, h2, h3, p) { + color: var(--text-normal) !important; +} + +/* Markdown title highlighting */ +div[class*="messagelogger-deleted"] [class*="contents"] :is(h1, h2, h3) { + color: var(--text-normal) !important; +} + +/* Bot "thinking" text highlighting */ +div[class*="messagelogger-deleted"] [class*="colorStandard"] { + color: var(--text-normal) !important; +} + +/* Embed highlighting */ +div[class*="messagelogger-deleted"] article :is(div, span, h1, h2, h3, p) { + color: var(--text-normal) !important; +} + +div[class*="messagelogger-deleted"] a { + color: var(--text-link) !important; + text-decoration: underline; +} diff --git a/src/equicordplugins/questionMarkReplacement/index.tsx b/src/equicordplugins/questionMarkReplacement/index.tsx index e63d44b0..98635403 100644 --- a/src/equicordplugins/questionMarkReplacement/index.tsx +++ b/src/equicordplugins/questionMarkReplacement/index.tsx @@ -5,7 +5,7 @@ */ import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; -import { definePluginSettings } from "@api/Settings"; +import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -28,8 +28,9 @@ function replaceQuestionMarks(content: string): string { } } +migratePluginSettings("QuestionMarkReplacement", "QuestionMarkReplace"); export default definePlugin({ - name: "QuestionMarkReplace", + name: "QuestionMarkReplacement", description: "Replace all question marks with chosen string, if message only contains question marks.", authors: [Devs.nyx], diff --git a/src/equicordplugins/search/index.ts b/src/equicordplugins/search/index.ts deleted file mode 100644 index 20c38413..00000000 --- a/src/equicordplugins/search/index.ts +++ /dev/null @@ -1,84 +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, findOption } from "@api/Commands"; -import { Devs, EquicordDevs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "Search", - authors: [Devs.JacobTm, EquicordDevs.thororen], - description: "Searchs the web.", - dependencies: ["CommandsAPI"], - commands: [{ - name: "search", - description: "Generates search link.", - options: [ - { - type: ApplicationCommandOptionType.STRING, - name: "Search query", - description: "What do you want to search?", - required: true - }, - { - type: ApplicationCommandOptionType.STRING, - name: "Search engine", - description: "What do you want to search?", - required: true, - choices: [ - { label: "Google", name: "Google", value: "google" }, - { label: "Bing", name: "Bing", value: "bing" }, - { label: "DuckDuckGo", name: "DuckDuckGo", value: "duckduckgo" }, - { label: "Brave", name: "Brave", value: "brave" }, - { label: "Yahoo", name: "Yahoo", value: "yahoo" }, - { label: "Yandex", name: "Yandex", value: "yandex" }, - ] - } - ], - - execute(args) { - const rfc3986EncodeURIComponent = str => encodeURIComponent(str).replace(/[!'()*]/g, escape); - const query = findOption(args, "Search query"); - const engine = findOption(args, "Search engine"); - let link; - switch (engine) { - case "google": - link = `https://google.com/search?query=${rfc3986EncodeURIComponent(query)}`; - break; - case "bing": - link = `https://bing.com/search?q=${rfc3986EncodeURIComponent(query)}`; - break; - case "duckduckgo": - link = `https://duckduckgo.com/${rfc3986EncodeURIComponent(query)}`; - break; - case "brave": - link = `https://search.brave.com/search?q=${rfc3986EncodeURIComponent(query)}`; - break; - case "yahoo": - link = `https://search.yahoo.com/search?p=${rfc3986EncodeURIComponent(query)}`; - break; - case "yandex": - link = `https://yandex.com/search?text=${rfc3986EncodeURIComponent(query)}`; - break; - } - return { - content: link - }; - } - }], -}); diff --git a/src/equicordplugins/showBadgesInChat/index.tsx b/src/equicordplugins/showBadgesInChat/index.tsx index c22975ad..54283113 100644 --- a/src/equicordplugins/showBadgesInChat/index.tsx +++ b/src/equicordplugins/showBadgesInChat/index.tsx @@ -6,7 +6,7 @@ import { addDecoration, removeDecoration } from "@api/MessageDecorations"; import { Devs, EquicordDevs } from "@utils/constants"; -import { isEquicordPluginDev, isPluginDev } from "@utils/misc"; +import { isEquicordPluginDev, isPluginDev, isSuncordPluginDev } from "@utils/misc"; import definePlugin from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import badges from "plugins/_api/badges"; @@ -60,6 +60,30 @@ function CheckBadge({ badge, author }: { badge: string; author: User; }): JSX.El /> ) : null; + case "SuncordDonor": + return ( + + {badges.getSuncordDonorBadges(author.id)?.map((badge: any) => ( + + ))} + + ); + case "SuncordContributer": + return isSuncordPluginDev(author.id) ? ( + + + + ) : null; case "VencordDonor": return ( @@ -126,6 +150,8 @@ function ChatBadges({ author }: { author: User; }) { {settings.store.showEquicordDonor && } {settings.store.showEquicordContributor && } + {settings.store.showSuncordDonor && } + {settings.store.showSuncordContributor && } {settings.store.showVencordDonor && } {settings.store.showVencordContributor && } {settings.store.showDiscordProfile && } diff --git a/src/equicordplugins/showBadgesInChat/settings.tsx b/src/equicordplugins/showBadgesInChat/settings.tsx index 2336a024..f8bb64f1 100644 --- a/src/equicordplugins/showBadgesInChat/settings.tsx +++ b/src/equicordplugins/showBadgesInChat/settings.tsx @@ -33,6 +33,30 @@ const settings = definePluginSettings({ hidden: true, default: 1 }, + showSuncordDonor: { + type: OptionType.BOOLEAN, + description: "Enable to show Suncord Donor badges in chat.", + hidden: true, + default: true + }, + SuncordDonorPosition: { + type: OptionType.NUMBER, + description: "The position of the Suncord Donor badges.", + hidden: true, + default: 2 + }, + showSuncordContributor: { + type: OptionType.BOOLEAN, + description: "Enable to show Suncord Contributor badges in chat.", + hidden: true, + default: true + }, + SuncordContributorPosition: { + type: OptionType.NUMBER, + description: "The position of the Suncord Contributor badge.", + hidden: true, + default: 3 + }, showVencordDonor: { type: OptionType.BOOLEAN, description: "Enable to show Vencord donor badges in chat.", @@ -43,7 +67,7 @@ const settings = definePluginSettings({ type: OptionType.NUMBER, description: "The position of the Vencord Donor badges.", hidden: true, - default: 2 + default: 4 }, showVencordContributor: { type: OptionType.BOOLEAN, @@ -55,7 +79,7 @@ const settings = definePluginSettings({ type: OptionType.NUMBER, description: "The position of the Vencord Contributor badge.", hidden: true, - default: 3 + default: 5 }, showDiscordProfile: { type: OptionType.BOOLEAN, @@ -67,7 +91,7 @@ const settings = definePluginSettings({ type: OptionType.NUMBER, description: "The position of the Discord profile badges.", hidden: true, - default: 4 + default: 6 }, showDiscordNitro: { type: OptionType.BOOLEAN, @@ -79,7 +103,7 @@ const settings = definePluginSettings({ type: OptionType.NUMBER, description: "The position of the Discord Nitro badge.", hidden: true, - default: 5 + default: 7 }, badgeSettings: { type: OptionType.COMPONENT, @@ -94,6 +118,8 @@ const BadgeSettings = () => { const [images, setImages] = useState([ { src: "https://i.imgur.com/KsxHlbD.png", shown: settings.store.showEquicordDonor, title: "Equicord donor badges", key: "EquicordDonor", position: settings.store.EquicordDonorPosition }, { src: "https://i.imgur.com/rJDRtUB.png", shown: settings.store.showEquicordContributor, title: "Equicord contributor badge", key: "EquicordContributer", position: settings.store.EquicordContributorPosition }, + { src: "https://i.imgur.com/H3GPhpd.png", shown: settings.store.showSuncordDonor, title: "Suncord donor badges", key: "SuncordDonor", position: settings.store.SuncordDonorPosition }, + { src: "https://raw.githubusercontent.com/verticalsync/Suncord/main/src/assets/icon.png", shown: settings.store.showSuncordContributor, title: "Suncord contributor badge", key: "SuncordContributer", position: settings.store.SuncordContributorPosition }, { src: "https://cdn.discordapp.com/emojis/1026533070955872337.png", shown: settings.store.showVencordDonor, title: "Vencord donor badges", key: "VencordDonor", position: settings.store.VencordDonorPosition }, { src: "https://vencord.dev/assets/favicon.png", shown: settings.store.showVencordContributor, title: "Vencord contributor badge", key: "VencordContributer", position: settings.store.VencordContributorPosition }, { src: "https://cdn.discordapp.com/badge-icons/bf01d1073931f921909045f3a39fd264.png", shown: settings.store.showDiscordProfile, title: "Discord profile badges (HypeSquad, Discord Staff, Active Developer, etc.)", key: "DiscordProfile", position: settings.store.DiscordProfilePosition }, @@ -111,6 +137,14 @@ const BadgeSettings = () => { settings.store.EquicordContributorPosition = image.position; settings.store.showEquicordContributor = image.shown; break; + case "SuncordDonor": + settings.store.SuncordDonorPosition = image.position; + settings.store.showSuncordDonor = image.shown; + break; + case "SuncordContributer": + settings.store.SuncordContributorPosition = image.position; + settings.store.showSuncordContributor = image.shown; + break; case "VencordDonor": settings.store.VencordDonorPosition = image.position; settings.store.showVencordDonor = image.shown; diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index fd391638..7a970f91 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -27,7 +27,7 @@ import { openContributorModal } from "@components/PluginSettings/ContributorModa import { Devs } from "@utils/constants"; import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; -import { isEquicordPluginDev, isPluginDev } from "@utils/misc"; +import { isEquicordPluginDev, isPluginDev, isSuncordPluginDev } from "@utils/misc"; import { closeModal, Modals, openModal } from "@utils/modal"; import definePlugin from "@utils/types"; import { Forms, Toasts, UserStore } from "@webpack/common"; @@ -35,6 +35,7 @@ import { User } from "discord-types/general"; const CONTRIBUTOR_BADGE = "https://vencord.dev/assets/favicon.png"; const EQUICORD_CONTRIBUTOR_BADGE = "https://i.imgur.com/rJDRtUB.png"; +const SUNCORD_CONTRIBUTOR_BADGE = "https://raw.githubusercontent.com/verticalsync/Suncord/main/src/assets/icon.png"; const ContributorBadge: ProfileBadge = { description: "Vencord Contributor", @@ -52,6 +53,14 @@ const EquicordContributorBadge: ProfileBadge = { onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId)) }; +const SuncordContributorBadge: ProfileBadge = { + description: "Suncord Contributor", + image: SUNCORD_CONTRIBUTOR_BADGE, + position: BadgePosition.START, + shouldShow: ({ userId }) => isSuncordPluginDev(userId), + onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId)) +}; + let DonorBadges = {} as Record>>; let EquicordDonorBadges = {} as Record>>; let SuncordDonorBadges = {} as Record>>; @@ -151,6 +160,7 @@ export default definePlugin({ async start() { Vencord.Api.Badges.addBadge(ContributorBadge); Vencord.Api.Badges.addBadge(EquicordContributorBadge); + Vencord.Api.Badges.addBadge(SuncordContributorBadge); await loadAllBadges(); }, diff --git a/src/plugins/replaceGoogleSearch/index.tsx b/src/plugins/replaceGoogleSearch/index.tsx index 43b0762a..986534b5 100644 --- a/src/plugins/replaceGoogleSearch/index.tsx +++ b/src/plugins/replaceGoogleSearch/index.tsx @@ -5,7 +5,7 @@ */ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; -import { definePluginSettings } from "@api/Settings"; +import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Flex, Menu } from "@webpack/common"; @@ -93,6 +93,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, _props) } }; +migratePluginSettings("ReplaceGoogleSearch", "Search"); export default definePlugin({ name: "ReplaceGoogleSearch", description: "Replaces the Google search with different Engines", diff --git a/src/utils/constants.ts b/src/utils/constants.ts index ac09f865..898db29f 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -669,8 +669,47 @@ export const EquicordDevs = Object.freeze({ }, } satisfies Record); +export const SuncordDevs = /* #__PURE__*/ Object.freeze({ + nyx: { + name: "verticalsync", + id: 328165170536775680n, + }, + bhop: { + name: "femeie", + id: 442626774841556992n, + }, + Drag: { + name: "dragalt_", + id: 1189903210564038697n, + }, + Woosh: { + name: "w00shh.", + id: 689165844835860522n, + }, + Cortex: { + name: "Cortex", + id: 825069530376044594n, + }, + thororen: { + name: "thororen", + id: 848339671629299742n, + }, + nexpid: { + name: "Nexpid", + id: 853550207039832084n, + }, + KrystalSkull: { + name: "krystalskullofficial", + id: 929208515883569182n, + }, + SerStars: { + name: "SerStars", + id: 861631850681729045n, + }, +} satisfies Record); + // iife so #__PURE__ works correctly -export const DevsById = /* #__PURE__*/ (() => +export const VencordDevsById = /* #__PURE__*/ (() => Object.freeze(Object.fromEntries( Object.entries(Devs) .filter(d => d[1].id !== 0n) @@ -685,3 +724,11 @@ export const EquicordDevsById = /* #__PURE__*/ (() => .map(([_, v]) => [v.id, v] as const) )) )() as Record; + +export const SuncordDevsById = /* #__PURE__*/ (() => + Object.freeze(Object.fromEntries( + Object.entries(SuncordDevs) + .filter(d => d[1].id !== 0n) + .map(([_, v]) => [v.id, v] as const) + )) +)() as Record; diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 2738b63b..6a8ad853 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -18,7 +18,7 @@ import { Clipboard, Toasts } from "@webpack/common"; -import { DevsById, EquicordDevsById } from "./constants"; +import { EquicordDevsById, SuncordDevsById, VencordDevsById } from "./constants"; /** * Calls .join(" ") on the arguments @@ -94,8 +94,9 @@ export function identity(value: T): T { // "In summary, we recommend looking for the string Mobi anywhere in the User Agent to detect a mobile device." export const isMobile = navigator.userAgent.includes("Mobi"); -export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id); +export const isPluginDev = (id: string) => Object.hasOwn(VencordDevsById, id); export const isEquicordPluginDev = (id: string) => Object.hasOwn(EquicordDevsById, id); +export const isSuncordPluginDev = (id: string) => Object.hasOwn(SuncordDevsById, id); export function pluralise(amount: number, singular: string, plural = singular + "s") { return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;