aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-05-04 21:47:08 -0300
committerGitHub <noreply@github.com>2023-05-05 02:47:08 +0200
commit474932161fb6e50e90cbd4e1546255b6a520394e (patch)
tree9c62ec029314fbe8447ba85f5ef74e6870f4cc63 /src/plugins
parentbd95a25f4c111c3d0e2564fb1bfcf5b8e12e87de (diff)
downloadVencord-474932161fb6e50e90cbd4e1546255b6a520394e.tar.gz
Vencord-474932161fb6e50e90cbd4e1546255b6a520394e.tar.bz2
Vencord-474932161fb6e50e90cbd4e1546255b6a520394e.zip
Fix FakeNitro Stickers (#1048)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/apiMessageEvents.ts12
-rw-r--r--src/plugins/fakeNitro.tsx4
-rw-r--r--src/plugins/typingIndicator.tsx2
3 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/apiMessageEvents.ts b/src/plugins/apiMessageEvents.ts
index 1fe3623..fa46752 100644
--- a/src/plugins/apiMessageEvents.ts
+++ b/src/plugins/apiMessageEvents.ts
@@ -36,10 +36,14 @@ export default definePlugin({
{
find: ".handleSendMessage=",
replacement: {
- // checkIsMessageValid().then((function (isValidData) { ... getSendMessageOptionsForReply(data); ... sendMessage(channel.id, msg, void 0, mergeMessageSendOptions(...))
- match: /(?<=uploads:(\i),channel:\i\}\)\.then\(\()function\((\i)\)\{(var \i=\i\.valid.+?\.getSendMessageOptionsForReply\(\i\);)(?=.+?\.sendMessage\((\i)\.id,(\i),void 0,(\i\(.+?)\):)/,
- // checkIsMessageValid().then((async function (isValidData) { ...; if (await handlePresend(channel.id, msg, extra)) return; ...
- replace: "async function($2){$3 if (await Vencord.Api.MessageEvents._handlePreSend($4.id,$5,$6,$1)) return {shouldClear:true,shouldRefocus:true};"
+ // props.chatInputType...then((function(isMessageValid)... var parsedMessage = b.c.parse(channel,... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply);
+ // Lookbehind: validateMessage)({openWarningPopout:..., type: i.props.chatInputType, content: t, stickers: r, ...}).then((function(isMessageValid)
+ match: /(props\.chatInputType.+?\.then\(\()(function.+?var (\i)=\i\.\i\.parse\((\i),.+?var (\i)=\i\.\i\.getSendMessageOptionsForReply\(\i\);)(?<=\)\(({.+?})\)\.then.+?)/,
+ // props.chatInputType...then((async function(isMessageValid)... var replyOptions = f.g.getSendMessageOptionsForReply(pendingReply); if(await Vencord.api...) return { shoudClear:true, shouldRefocus:true };
+ replace: (_, rest1, rest2, parsedMessage, channel, replyOptions, extra) => "" +
+ `${rest1}async ${rest2}` +
+ `if(await Vencord.Api.MessageEvents._handlePreSend(${channel}.id,${parsedMessage},${extra},${replyOptions}))` +
+ "return{shoudClear:true,shouldRefocus:true};"
}
},
{
diff --git a/src/plugins/fakeNitro.tsx b/src/plugins/fakeNitro.tsx
index b067f2a..1fb9fc3 100644
--- a/src/plugins/fakeNitro.tsx
+++ b/src/plugins/fakeNitro.tsx
@@ -641,7 +641,7 @@ export default definePlugin({
if (!settings.enableStickerBypass)
break stickerBypass;
- const sticker = StickerStore.getStickerById(extra?.stickerIds?.[0]!);
+ const sticker = StickerStore.getStickerById(extra.stickers?.[0]!);
if (!sticker)
break stickerBypass;
@@ -663,7 +663,7 @@ export default definePlugin({
link = `https://distok.top/stickers/${packId}/${sticker.id}.gif`;
}
- delete extra.stickerIds;
+ extra.stickers!.length = 0;
messageObj.content += " " + link + `&name=${encodeURIComponent(sticker.name)}`;
}
}
diff --git a/src/plugins/typingIndicator.tsx b/src/plugins/typingIndicator.tsx
index 4b0d162..8f98d5b 100644
--- a/src/plugins/typingIndicator.tsx
+++ b/src/plugins/typingIndicator.tsx
@@ -57,7 +57,7 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
if (isChannelMuted) return null;
}
- const myId = UserStore.getCurrentUser().id;
+ const myId = UserStore.getCurrentUser()?.id;
const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
let tooltipText: string;