diff --git a/plugins/ChatboxAvatar/src/index.tsx b/plugins/ChatboxAvatar/src/index.tsx index 651bd1d..405e015 100644 --- a/plugins/ChatboxAvatar/src/index.tsx +++ b/plugins/ChatboxAvatar/src/index.tsx @@ -106,10 +106,12 @@ export default { plugin.storage[key] = plugin.storage[key] ?? defaults[key]; } - if (ChatInputActions) { - const target = ChatInputActions.type || ChatInputActions; + const actionsTarget = ChatInputActions?.type || ChatInputActions; + const sendTarget = ChatInputSendButton?.type || ChatInputSendButton; + + if (actionsTarget && actionsTarget !== sendTarget) { patches.push( - after("render", target, (args, ret) => { + after("render", actionsTarget, (args, ret) => { const position = getSetting("position", "after_actions"); if (position === "near_send") return ret; return ( @@ -123,10 +125,9 @@ export default { ); } - if (ChatInputSendButton) { - const target = ChatInputSendButton.type || ChatInputSendButton; + if (sendTarget && sendTarget !== actionsTarget) { patches.push( - after("render", target, (args, ret) => { + after("render", sendTarget, (args, ret) => { const position = getSetting("position", "after_actions"); if (position !== "near_send") return ret; return ( @@ -138,6 +139,21 @@ export default { }) ); } + + if (actionsTarget && actionsTarget === sendTarget) { + patches.push( + after("render", actionsTarget, (args, ret) => { + const position = getSetting("position", "after_actions"); + return ( + + {position === "before_actions" && } + {ret} + {(position === "after_actions" || position === "near_send") && } + + ); + }) + ); + } }, onUnload() { for (const unpatch of patches) {