From f4d04f12ad9c02a8526227bff3f61beaa48e9a51 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:30:19 -0400 Subject: [PATCH] Update Kyuu Plugins --- README.md | 3 + src/equicordplugins/annamox/index.ts | 36 +++++++++-- src/equicordplugins/colorMessage/index.ts | 62 +++++++++++++++++++ src/equicordplugins/deadMembers/index.tsx | 62 +++++++++++++++++++ .../messageLinkTooltip/index.tsx | 4 +- src/equicordplugins/title/index.ts | 50 +++++++++++++++ 6 files changed, 211 insertions(+), 6 deletions(-) create mode 100644 src/equicordplugins/colorMessage/index.ts create mode 100644 src/equicordplugins/deadMembers/index.tsx create mode 100644 src/equicordplugins/title/index.ts diff --git a/README.md b/README.md index 8f7e6a4c..8fafe74f 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,10 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - BlockKrsip by D3SOX - BypassDND by Inbestigator - CleanChannelName by AutumnVN +- ColorMessage by Kyuuhachi - CopyUserMention by Cortex and castdrian - CustomAppIcons by Happy Enderman and SerStars +- DeadMembers by Kyuuhachi - DiscordColorways by DaBluLite - DNDWhilePlaying by thororen - DoNotLeak by Perny @@ -76,6 +78,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - SoundBoardLogger by Moxxie, fres, echo, thororen - TalkInReverse by Tolgchu - ThemeLibrary by Fafa +- Title by Kyuuhachi - UnlimitedAccounts by Balaclava and thororen - UserPFP by nexpid and thororen - VCSupport by thororen diff --git a/src/equicordplugins/annamox/index.ts b/src/equicordplugins/annamox/index.ts index 29fc8e93..17d8345d 100644 --- a/src/equicordplugins/annamox/index.ts +++ b/src/equicordplugins/annamox/index.ts @@ -27,6 +27,12 @@ export const settings = definePluginSettings({ description: "Remove gift button", restartNeeded: true, }, + emojiList: { + type: OptionType.BOOLEAN, + default: true, + description: "Remove unavailable categories from the emoji picker", + restartNeeded: true, + }, }); export default definePlugin({ @@ -66,10 +72,16 @@ export default definePlugin({ }, { // Settings, sidebar find: "Messages.BILLING_SETTINGS", - replacement: { - match: /\{header:[^:,]*\.Messages.BILLING_SETTINGS,[^}]*\]},/, - replace: "/*$&*/" - }, + replacement: [ + { + match: /(?<=Messages.BILLING_SETTINGS,)/, + replace: "capitalism:true," + }, + { + match: /\i\?\i:\i\.toSpliced\(3,0,\i\)/, + replace: "($&).filter(e=>!e.capitalism)", + }, + ], predicate: () => settings.store.billing, }, { // Gift button @@ -79,6 +91,22 @@ export default definePlugin({ replace: "return null;", }, predicate: () => settings.store.gift, + }, + { // Emoji list + find: "Messages.EMOJI_PICKER_CREATE_EMOJI_TITLE,size:", + replacement: { + match: /(\w+)=!\w+&&\w+.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/, + replace: "$&$1||" + }, + predicate: () => settings.store.emojiList, + }, + { // Emoji category list + find: "Messages.EMOJI_CATEGORY_TOP_GUILD_EMOJI.format({", + replacement: { + match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/, + replace: "$2.isNitroLocked||" + }, + predicate: () => settings.store.emojiList, } ], }); diff --git a/src/equicordplugins/colorMessage/index.ts b/src/equicordplugins/colorMessage/index.ts new file mode 100644 index 00000000..79ab4cfd --- /dev/null +++ b/src/equicordplugins/colorMessage/index.ts @@ -0,0 +1,62 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { definePluginSettings } from "@api/Settings"; +import * as Styles from "@api/Styles"; +import { makeRange } from "@components/PluginSettings/components"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByCodeLazy } from "@webpack"; + +const useMessageAuthor = findByCodeLazy('"Result cannot be null because the message is not null"'); + +import style from "./style.css?managed"; + +export const settings = definePluginSettings({ + saturation: { + type: OptionType.SLIDER, + description: "Message color saturation", + markers: makeRange(0, 100, 10), + default: 20, + onChange() { + updateStyle(); + }, + }, +}); + +function updateStyle() { + (Styles.requireStyle(style).dom!.sheet!.cssRules[0] as CSSStyleRule) + .style.setProperty("--98-message-color-saturation", `${settings.store.saturation}`); +} + +export default definePlugin({ + name: "ColorMessage", + description: "Colors message content with author's role color", + authors: [Devs.Kyuuhachi], + settings, + + patches: [ + { + find: '.Messages.MESSAGE_EDITED,")"', + replacement: { + match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/, + replace: 'style:{"--98-message-color":$self.useMessageColor($1)},' + } + }, + ], + + useMessageColor(messageId: string) { + return useMessageAuthor(messageId).colorString; + }, + + start() { + Styles.enableStyle(style); + updateStyle(); + }, + stop() { + Styles.disableStyle(style); + }, +}); diff --git a/src/equicordplugins/deadMembers/index.tsx b/src/equicordplugins/deadMembers/index.tsx new file mode 100644 index 00000000..7e253de4 --- /dev/null +++ b/src/equicordplugins/deadMembers/index.tsx @@ -0,0 +1,62 @@ +/* + * 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"; +import { ChannelStore, GuildMemberStore, useStateFromStores } from "@webpack/common"; + +export default definePlugin({ + name: "DeadMembers", + description: "Shows when the sender of a message has left the guild", + authors: [Devs.Kyuuhachi], + + patches: [ + { + find: '.BADGES=1]="BADGES"', + replacement: { + match: /(\i)=\{className:\i.username,style:.*?onContextMenu:\i,children:.*?\},/, + replace: "$&__dummyvar=($1.children=$self.wrapMessageAuthor(arguments[0],$1.children))," + } + }, + { + find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL", + replacement: { + match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/, + replace: "$self.wrapForumAuthor({...$1,$2},$&)" + } + }, + ], + + wrapMessageAuthor({ message }, text) { + const channel = ChannelStore.getChannel(message.channel_id); + return message.webhookId + ? text + : ; + }, + + wrapForumAuthor({ channel, user }, text) { + return !user + ? text + : ; + }, +}); + + +function DeadIndicator({ channel, userId, text }) { + const isMember = useStateFromStores( + [GuildMemberStore], + () => GuildMemberStore.isMember(channel?.guild_id, userId), + ); + return channel?.guild_id && !isMember ? {text} : text; +} diff --git a/src/equicordplugins/messageLinkTooltip/index.tsx b/src/equicordplugins/messageLinkTooltip/index.tsx index ca2d1d1e..41b07eac 100644 --- a/src/equicordplugins/messageLinkTooltip/index.tsx +++ b/src/equicordplugins/messageLinkTooltip/index.tsx @@ -38,7 +38,7 @@ const { Spinner } = proxyLazy(() => Forms as any as { SpinnerTypes: typeof SpinnerTypes; }); -const ChannelMessage = findComponentByCodeLazy("childrenExecutedCommand:", ".hideAccessories"); +const ChannelMessage = findComponentByCodeLazy("isFirstMessageInForumPost", "trackAnnouncementViews") as ComponentType; export default definePlugin({ name: "MessageLinkTooltip", @@ -49,7 +49,7 @@ export default definePlugin({ { find: ',className:"channelMention",children:[', replacement: { - match: /(?<=\.jsxs\)\()(\i\.\i)/, + match: /(?<=\.jsxs\)\()(\i\.\i)(?=,\{role:"link")/, replace: "$self.wrapComponent(arguments[0], $1)" } } diff --git a/src/equicordplugins/title/index.ts b/src/equicordplugins/title/index.ts new file mode 100644 index 00000000..0314f815 --- /dev/null +++ b/src/equicordplugins/title/index.ts @@ -0,0 +1,50 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { definePluginSettings } from "@api/Settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByCodeLazy } from "@webpack"; + +const flashPageTitle = findByCodeLazy("=>({flashQueue:[..."); +const rootTitle = { base: null as string | null }; + +export const settings = definePluginSettings({ + title: { + type: OptionType.STRING, + default: "Vencord", + description: "Window title prefix", + onChange: setTitle, + }, +}); + +function setTitle(v: string) { + rootTitle.base = v || null; + flashPageTitle({ messages: 0 })(); +} + +export default definePlugin({ + name: "Title", + description: "Replaces the window title prefix", + authors: [Devs.Kyuuhachi], + settings, + + patches: [ + { + find: 'isPlatformEmbedded?void 0:"Discord"', + replacement: { + match: /\{base:\i\("?\d+?"?\)\.isPlatformEmbedded\?void 0:"Discord"\}/, + replace: "$self.rootTitle", + }, + }, + ], + + start() { + setTitle(settings.store.title); + }, + + rootTitle, +});