fix(vcDoubleClick): update for new discord build (#1862)

This commit is contained in:
Nico 2023-10-25 16:58:02 +02:00 committed by V
parent 2478ffb695
commit e69236c5f8

@ -30,20 +30,22 @@ export default definePlugin({
description: "Join voice chats via double click instead of single click", description: "Join voice chats via double click instead of single click",
authors: [Devs.Ven, Devs.D3SOX], authors: [Devs.Ven, Devs.D3SOX],
patches: [ patches: [
{ ...[
find: "VoiceChannel.renderPopout", ".handleVoiceStatusClick", // voice channels
".handleClickChat" // stage channels
].map(find => ({
find,
// hack: these are not React onClick, it is a custom prop handled by Discord // hack: these are not React onClick, it is a custom prop handled by Discord
// thus, replacing this with onDoubleClick won't work, and you also cannot check // thus, replacing this with onDoubleClick won't work, and you also cannot check
// e.detail since instead of the event they pass the channel. // e.detail since instead of the event they pass the channel.
// do this timer workaround instead // do this timer workaround instead
replacement: [ replacement: [
// voice/stage channels
{ {
match: /onClick:function\(\)\{(e\.handleClick.+?)}/g, match: /onClick:\(\)=>\{this.handleClick\(\)/g,
replace: "onClick:function(){$self.schedule(()=>{$1},e)}", replace: "onClick:()=>{$self.schedule(()=>{this.handleClick()},this)",
}, },
], ]
}, })),
{ {
// channel mentions // channel mentions
find: ".shouldCloseDefaultModals", find: ".shouldCloseDefaultModals",