From 0ff070443ef7e11fa9e2d0c86a4a1db53e1f6e10 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 21 Nov 2024 04:16:46 +0100 Subject: [PATCH] need to bind handlers --- src/plugins/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 089de70e9..37f8be8be 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -27,7 +27,7 @@ import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/Messag import { Settings } from "@api/Settings"; import { Logger } from "@utils/Logger"; import { canonicalizeFind } from "@utils/patches"; -import { Patch, Plugin, ReporterTestable, StartAt } from "@utils/types"; +import { Patch, Plugin, PluginDef, ReporterTestable, StartAt } from "@utils/types"; import { FluxDispatcher } from "@webpack/common"; import { FluxEvents } from "@webpack/types"; @@ -121,6 +121,15 @@ for (const p of pluginsValues) if (isPluginEnabled(p.name)) { if (p.renderMessageAccessory) neededApiPlugins.add("MessageAccessoriesAPI"); if (p.renderMessageDecoration) neededApiPlugins.add("MessageDecorationsAPI"); if (p.renderMessagePopoverButton) neededApiPlugins.add("MessagePopoverAPI"); + + const keysToBind: Array = [ + "onBeforeMessageEdit", "onBeforeMessageSend", "onMessageClick", + "renderChatBarButton", "renderMemberListDecorator", "renderMessageAccessory", "renderMessageDecoration", "renderMessagePopoverButton" + ]; + + for (const key of keysToBind) { + p[key] &&= p[key].bind(p) as any; + } } for (const p of neededApiPlugins) {