From f749baf81e318613cb49cfbb5d0c409397a23bd8 Mon Sep 17 00:00:00 2001 From: V Date: Fri, 24 Apr 2026 00:30:52 +0200 Subject: [PATCH] fix some broken plugins (#4142) Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com> --- src/plugins/consoleJanitor/index.tsx | 4 +-- src/plugins/fakeNitro/index.tsx | 29 +----------------- src/plugins/favEmojiFirst/index.ts | 2 +- src/plugins/favGifSearch/index.tsx | 2 +- src/plugins/messageLogger/index.tsx | 42 -------------------------- src/plugins/noBlockedMessages/index.ts | 23 +++++++++----- src/plugins/volumeBooster/index.ts | 2 +- src/plugins/whoReacted/index.tsx | 4 +-- 8 files changed, 23 insertions(+), 85 deletions(-) diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 2cde73cc9..8e811e807 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -135,7 +135,7 @@ export default definePlugin({ { find: 'The "interpolate" function is deprecated in v10 (use "to" instead)', replacement: { - match: /,console.warn\(\i\+'The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/, + match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/, replace: "" } }, @@ -196,7 +196,7 @@ export default definePlugin({ find: "Slow dispatch on", replacement: [ { - match: /\i\.totalTime>\i&&\i\.verbose\([`"]Slow dispatch on.{0,55}\);/, + match: /\i\.totalTime>\d+?&&\i\.verbose\([`"]Slow dispatch on.{0,55}\);/, replace: "" }, ] diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 07fb6b74a..953b714eb 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -22,7 +22,7 @@ import { ApngBlendOp, ApngDisposeOp, parseAPNG } from "@utils/apng"; import { Devs } from "@utils/constants"; import { getCurrentGuild } from "@utils/discord"; import { Logger } from "@utils/Logger"; -import definePlugin, { OptionType, Patch } from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import type { Emoji, Message, Sticker } from "@vencord/discord-types"; import { StickerFormatType } from "@vencord/discord-types/enums"; import { findByCodeLazy, findByPropsLazy, proxyLazyWebpack } from "@webpack"; @@ -151,26 +151,6 @@ const hasExternalStickerPerms = (channelId: string) => hasPermission(channelId, const hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS); const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES); -function makeBypassPatches(): Omit { - const mapping: Array<{ func: string, predicate?: () => boolean; }> = [ - { func: "canUseCustomStickersEverywhere", predicate: () => settings.store.enableStickerBypass }, - { func: "canUseHighVideoUploadQuality", predicate: () => settings.store.enableStreamQualityBypass }, - { func: "canStreamQuality", predicate: () => settings.store.enableStreamQualityBypass }, - { func: "canUseClientThemes" }, - { func: "canUsePremiumAppIcons" } - ]; - - return { - find: "canUseCustomStickersEverywhere:", - replacement: mapping.map(({ func, predicate }) => ({ - match: new RegExp(String.raw`(?<=${func}:)\i`), - replace: "() => true", - noWarn: true, - predicate - })) - }; -} - export default definePlugin({ name: "FakeNitro", authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN, Devs.sadan], @@ -181,8 +161,6 @@ export default definePlugin({ settings, patches: [ - // TODO: remove - makeBypassPatches(), { find: "canUseCustomStickersEverywhere:", replacement: [ @@ -286,11 +264,6 @@ export default definePlugin({ match: /(?<=CONNECTION_OPEN:function\((\i)\){)/, replace: (_, props) => `$self.handleProtoChange(${props}.userSettingsProto,${props}.user);` }, - { - match: /function (\i)\((\i)\){(?=.*CONNECTION_OPEN:\1)/, - replace: (m, funcName, props) => `${m}$self.handleProtoChange(${props}.userSettingsProto,${props}.user);`, - noWarn: true - }, { // Overwrite non local proto changes with our local settings match: /let{settings:/, diff --git a/src/plugins/favEmojiFirst/index.ts b/src/plugins/favEmojiFirst/index.ts index 11692b9fd..2f6f9be92 100644 --- a/src/plugins/favEmojiFirst/index.ts +++ b/src/plugins/favEmojiFirst/index.ts @@ -58,7 +58,7 @@ export default definePlugin({ { // https://regex101.com/r/x2mobQ/1 // searchEmojis(...,maxCount: stuff) ... endEmojis = emojis.slice(0, maxCount - gifResults.length) - match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\i,\i(?:-\i\.length){2}\))\)/, + match: /,maxCount:(\i)(.{1,500}\i)=(\i)\.slice\(0,(Math\.max\(\d+?,\i(?:-\i\.length){2}\))\)/, // ,maxCount:Infinity ... endEmojis = (emojis.sliceTo = n, emojis) replace: ",maxCount:Infinity$2=($3.sliceTo = $4, $3)" } diff --git a/src/plugins/favGifSearch/index.tsx b/src/plugins/favGifSearch/index.tsx index 2a3d14728..5061ba86d 100644 --- a/src/plugins/favGifSearch/index.tsx +++ b/src/plugins/favGifSearch/index.tsx @@ -93,7 +93,7 @@ export default definePlugin({ { // https://regex101.com/r/07gpzP/1 // ($1 renderHeaderContent=function { ... switch (x) ... case FAVORITES:return) ($2) ($3 case default: ... return r.jsx(($), {...props})) - match: /(renderHeaderContent\(\).{1,150}FAVORITES:return)(.{1,150});(case.{1,200}default:.{0,50}?return\(0,\i\.jsx\)\((?\i\..{1,10}),)/, + match: /(renderHeaderContent\(\).{1,150}FAVORITES:return)(.{1,150});(case.{1,200}default:.{0,50}?return\(0,\i\.jsx\)\((?\i\.\i),)/, replace: "$1 this.state.resultType === 'Favorites' ? $self.renderSearchBar(this, $) : $2;$3" }, { diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index ac3436f3e..67e88a8fa 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -362,16 +362,6 @@ export default definePlugin({ return; ` }, - { - noWarn: true, - match: /function (?=.+?MESSAGE_DELETE:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, - replace: - "function $1($2){" + - " var cache = $3getOrCreate($2.channelId);" + - " cache = $self.handleDelete(cache, $2, false);" + - " $3commit(cache);" + - "}" - }, { // Add deleted=true to all target messages in the MESSAGE_DELETE_BULK event match: /(?<=MESSAGE_DELETE_BULK:function\((\i)\){)(?=let.{0,100}(\i\.\i)\.getOrCreate)/, @@ -382,16 +372,6 @@ export default definePlugin({ return; ` }, - { - match: /function (?=.+?MESSAGE_DELETE_BULK:(\i))\1\((\i)\){let.+?((?:\i\.){2})getOrCreate.+?}(?=function)/, - noWarn: true, - replace: - "function $1($2){" + - " var cache = $3getOrCreate($2.channelId);" + - " cache = $self.handleDelete(cache, $2, true);" + - " $3commit(cache);" + - "}" - }, { // Add current cached content + new edit time to cached message's editHistory match: /(MESSAGE_UPDATE:function\((\i)\).+?)\.update\((\i)/, @@ -406,18 +386,6 @@ export default definePlugin({ .update($3 ` }, - { - noWarn: true, - match: /(function (\i)\((\i)\).+?)\.update\((\i)(?=.*MESSAGE_UPDATE:\2)/, - replace: "$1" + - ".update($4,m =>" + - " (($3.message.flags & 64) === 64 || $self.shouldIgnore($3.message, true)) ? m :" + - " $3.message.edited_timestamp && $3.message.content !== m.content ?" + - " m.set('editHistory',[...(m.editHistory || []), $self.makeEdit($3.message, m)]) :" + - " m" + - ")" + - ".update($4" - }, { // fix up key (edit last message) attempting to edit a deleted message match: /(?<=getLastEditableMessage\(\i\)\{.{0,200}\.find\((\i)=>)/, @@ -533,16 +501,6 @@ export default definePlugin({ { match: /(?<=MESSAGE_DELETE_BULK:function\(\i\)\{)/, replace: "return;" - }, - { - match: /MESSAGE_DELETE:\i,/, - replace: "MESSAGE_DELETE:()=>{},", - noWarn: true - }, - { - match: /MESSAGE_DELETE_BULK:\i,/, - replace: "MESSAGE_DELETE_BULK:()=>{},", - noWarn: true } ] }, diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 9f14a088a..e89aa27b9 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -63,19 +63,26 @@ export default definePlugin({ } ] }, - ...[ - '"MessageStore"', - '"ReadStateStore"' - ].map(find => ({ - find, + { + find: '"MessageStore"', predicate: () => settings.store.ignoreMessages, replacement: [ { - match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/, - replace: (_, _funcName, props) => `if($self.shouldIgnoreMessage(${props}.message))return;` + match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, + replace: (_, props) => `if($self.shouldIgnoreMessage(${props}.message))return;` } ] - })) + }, + { + find: '"ReadStateStore"', + predicate: () => settings.store.ignoreMessages, + replacement: [ + { + match: /(?<=MESSAGE_CREATE:function\((\i)\){)/, + replace: (_, props) => `if($self.shouldIgnoreMessage(${props}.message))return;` + } + ] + } ], shouldIgnoreMessage(message: Message) { diff --git a/src/plugins/volumeBooster/index.ts b/src/plugins/volumeBooster/index.ts index e379686ad..ea4b5cd35 100644 --- a/src/plugins/volumeBooster/index.ts +++ b/src/plugins/volumeBooster/index.ts @@ -99,7 +99,7 @@ export default definePlugin({ find: "AudioContextSettingsMigrated", replacement: [ { - match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\i\(\i,\i,)\1(?=\))/, + match: /(?<=isLocalMute\(\i,\i\),volume:(\i).+?\(0,\i\.\i\)\(\i,\i,\{volume:)\1(?=\}\))/, replace: "$&>200?200:$&" }, { diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx index 9daade638..c257017ea 100644 --- a/src/plugins/whoReacted/index.tsx +++ b/src/plugins/whoReacted/index.tsx @@ -92,8 +92,8 @@ export default definePlugin({ { find: '"MessageReactionsStore"', replacement: { - match: /function (\i)\(\){(\i)={}(?=.*CONNECTION_OPEN:\1)/, - replace: "$&;$self.reactions=$2;" + match: /CONNECTION_OPEN:function\(\){(\i)={}/, + replace: "$&;$self.reactions=$1;" } }, {