From 577407bab9ee9913840799755ad0460dc04c9fd0 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 5 Feb 2026 04:02:36 +0100 Subject: [PATCH] fix some things broken by a recent Discord update --- src/plugins/_api/commands.ts | 16 +++++++++++----- src/plugins/_api/menuItemDemangler.ts | 2 +- src/plugins/_api/messageEvents.ts | 2 +- src/plugins/experiments/index.tsx | 4 ++-- src/utils/modal.tsx | 3 ++- src/webpack/common/components.ts | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/plugins/_api/commands.ts b/src/plugins/_api/commands.ts index cca1a686..2af65b6f 100644 --- a/src/plugins/_api/commands.ts +++ b/src/plugins/_api/commands.ts @@ -51,11 +51,17 @@ export default definePlugin({ // Show plugin name instead of "Built-In" { find: "#{intl::COMMANDS_OPTIONAL_COUNT}", - replacement: { - // ...children: p?.name - match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/, - replace: "$1.plugin||($&)" - } + replacement: [ + { + // ...children: p?.name + match: /(?<=:(\i)\.displayDescription\}.{0,200}children:).{0,50}\.name(?=\}\))/, + replace: "$1.plugin||($&)" + }, + { + match: /children:(?=\i\?\?\i\?\.name)(?<=command:(\i),.+?)/, + replace: "children:$1.plugin??" + } + ] } ], }); diff --git a/src/plugins/_api/menuItemDemangler.ts b/src/plugins/_api/menuItemDemangler.ts index b6a03fe8..f71e8499 100644 --- a/src/plugins/_api/menuItemDemangler.ts +++ b/src/plugins/_api/menuItemDemangler.ts @@ -29,7 +29,7 @@ export default definePlugin({ required: true, patches: [ { - find: '"Menu API', + find: "Menu API only allows Items", replacement: { match: /function.{0,80}type===(\i\.\i)\).{0,50}navigable:.+?Menu API/s, replace: (m, mod) => { diff --git a/src/plugins/_api/messageEvents.ts b/src/plugins/_api/messageEvents.ts index ca38846b..70b7f26c 100644 --- a/src/plugins/_api/messageEvents.ts +++ b/src/plugins/_api/messageEvents.ts @@ -38,7 +38,7 @@ export default definePlugin({ find: ".handleSendMessage,onResize:", replacement: { // https://regex101.com/r/7iswuk/1 - match: /let (\i)=\i\.\i\.parse\((\i),.+?\.getSendMessageOptions\(\{.+?\}\);(?=.+?(\i)\.flags=)(?<=\)\(({.+?})\)\.then.+?)/, + match: /let (\i)=\i\.\i\.parse\((\i),.+?\.getSendMessageOptions\(\{.+?\}\)?;(?=.+?(\i)\.flags=)(?<=\)\(({.+?})\)\.then.+?)/, replace: (m, parsedMessage, channel, replyOptions, extra) => m + `if(await Vencord.Api.MessageEvents._handlePreSend(${channel}.id,${parsedMessage},${extra},${replyOptions}))` + "return{shouldClear:false,shouldRefocus:true};" diff --git a/src/plugins/experiments/index.tsx b/src/plugins/experiments/index.tsx index cb456fc7..ab97ae92 100644 --- a/src/plugins/experiments/index.tsx +++ b/src/plugins/experiments/index.tsx @@ -106,10 +106,10 @@ export default definePlugin({ }, // Enable experiment embed on sent experiment links { - find: '"Clear Treatment "', + find: "Clear Treatment ", replacement: [ { - match: /\i\.isStaff\(\)/, + match: /\i\??\.isStaff\(\)/, replace: "true" }, // Fix some tricky experiments name causing a client crash diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index 7396d151..cad37afa 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -101,7 +101,8 @@ interface Modals { }>; } -export const Modals: Modals = mapMangledModuleLazy(':"thin")', { +// TODO: move to new modal api +export const Modals: Modals = mapMangledModuleLazy(".MODAL_ROOT_LEGACY,", { ModalRoot: filters.componentByCode('.MODAL,"aria-labelledby":'), ModalHeader: filters.componentByCode(",id:"), ModalContent: filters.componentByCode("scrollbarType:"), diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index f06f830f..f44ba034 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -60,7 +60,7 @@ export const TextInput = waitForComponent("TextInput", filters.comp export const TextArea = waitForComponent("TextArea", filters.componentByCode("this.getPaddingRight()},id:")); export const Select = waitForComponent("Select", filters.componentByCode('"Select"')); export const SearchableSelect = waitForComponent("SearchableSelect", filters.componentByCode('"SearchableSelect"')); -export const Slider = waitForComponent("Slider", filters.componentByCode('"markDash".concat(')); +export const Slider = waitForComponent("Slider", filters.componentByCode("markDash", "this.renderMark(")); export const Popout = waitForComponent("Popout", filters.componentByCode("ref:this.ref,", "renderPopout:this.renderPopout,")); export const Dialog = waitForComponent("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1')); export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:"));