Skip to content

Commit a492f76

Browse files
committed
MessageEventsAPI: Fix for upcoming change
1 parent e280ed2 commit a492f76

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/plugins/_api/messageEvents.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ export default definePlugin({
3737
{
3838
find: ".handleSendMessage,onResize",
3939
replacement: {
40+
// FIXME: Simplify this change once all branches share the same code
4041
// props.chatInputType...then((function(isMessageValid)... var parsedMessage = b.c.parse(channel,... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply);
4142
// Lookbehind: validateMessage)({openWarningPopout:..., type: i.props.chatInputType, content: t, stickers: r, ...}).then((function(isMessageValid)
42-
match: /(\{openWarningPopout:.{0,100}type:this.props.chatInputType.+?\.then\()(\i=>\{.+?let (\i)=\i\.\i\.parse\((\i),.+?let (\i)=\i\.\i\.getSendMessageOptions\(\{.+?\}\);)(?<=\)\(({.+?})\)\.then.+?)/,
43+
match: /(\{openWarningPopout:.{0,100}type:this.props.chatInputType.+?\.then\((?:async )?)(\i=>\{.+?let (\i)=\i\.\i\.parse\((\i),.+?let (\i)=\i\.\i\.getSendMessageOptions\(\{.+?\}\);)(?<=\)\(({.+?})\)\.then.+?)/,
4344
// props.chatInputType...then((async function(isMessageValid)... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply); if(await Vencord.api...) return { shoudClear:true, shouldRefocus:true };
4445
replace: (_, rest1, rest2, parsedMessage, channel, replyOptions, extra) => "" +
45-
`${rest1}async ${rest2}` +
46+
`${rest1}${rest1.includes("async") ? "" : "async "}${rest2}` +
4647
`if(await Vencord.Api.MessageEvents._handlePreSend(${channel}.id,${parsedMessage},${extra},${replyOptions}))` +
4748
"return{shouldClear:false,shouldRefocus:true};"
4849
}

0 commit comments

Comments
 (0)