aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fakeNitro.ts
diff options
context:
space:
mode:
authorNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-09-20 02:44:31 -0300
committerNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-09-20 02:44:31 -0300
commit9550b74b2ac00be97201855efc85bc527926d610 (patch)
treec4eb84ca047091a2005d18411676ed1ede03700d /src/plugins/fakeNitro.ts
parent6cfb67a52ea692eebf2f01d3498cffb21050c7a4 (diff)
downloadVencord-9550b74b2ac00be97201855efc85bc527926d610.tar.gz
Vencord-9550b74b2ac00be97201855efc85bc527926d610.tar.bz2
Vencord-9550b74b2ac00be97201855efc85bc527926d610.zip
Fix broken FakeNitro patch
Diffstat (limited to 'src/plugins/fakeNitro.ts')
-rw-r--r--src/plugins/fakeNitro.ts27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/fakeNitro.ts b/src/plugins/fakeNitro.ts
index 1313145..e7f6743 100644
--- a/src/plugins/fakeNitro.ts
+++ b/src/plugins/fakeNitro.ts
@@ -103,6 +103,11 @@ interface StickerPack {
stickers: Sticker[];
}
+const enum FakeNoticeType {
+ Sticker,
+ Emoji
+}
+
const fakeNitroEmojiRegex = /\/emojis\/(\d+?)\.(png|webp|gif)/;
const fakeNitroStickerRegex = /\/stickers\/(\d+?)\./;
const fakeNitroGifStickerRegex = /\/attachments\/\d+?\/\d+?\/(\d+?)\.gif/;
@@ -306,16 +311,24 @@ export default definePlugin({
},
{
match: /(emojiSection.{0,50}description:)(\i)(?<=(\i)\.sticker,.+?)(?=,)/,
- replace: (_, rest, reactNode, props) => `${rest}$self.addFakeNotice("STICKER",${reactNode},!!${props}.renderableSticker?.fake)`
+ replace: (_, rest, reactNode, props) => `${rest}$self.addFakeNotice(${FakeNoticeType.Sticker},${reactNode},!!${props}.renderableSticker?.fake)`
}
]
},
{
- find: ".Messages.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION",
+ find: ".EMOJI_UPSELL_POPOUT_MORE_EMOJIS_OPENED,",
+ predicate: () => settings.store.transformEmojis,
+ replacement: {
+ match: /isDiscoverable:\i,shouldHideRoleSubscriptionCTA:\i,(?<=(\i)=\i\.node.+?)/,
+ replace: (m, node) => `${m}fakeNitroNode:${node},`
+ }
+ },
+ {
+ find: ".Messages.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION",
predicate: () => settings.store.transformEmojis,
replacement: {
- match: /((\i)=\i\.node,\i=\i\.expressionSourceGuild)(.+?return )(.{0,450}Messages\.EMOJI_POPOUT_PREMIUM_JOINED_GUILD_DESCRIPTION.+?}\))/,
- replace: (_, rest1, node, rest2, reactNode) => `${rest1},fakeNitroNode=${node}${rest2}$self.addFakeNotice("EMOJI",${reactNode},fakeNitroNode.fake)`
+ match: /(?<=\.Messages\.EMOJI_POPOUT_ADDED_PACK_DESCRIPTION.+?return )(.{0,1200}\.Messages\.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION.+?)(}\({)/,
+ replace: (_, reactNode, rest) => `$self.addFakeNotice(${FakeNoticeType.Emoji},${reactNode},!!arguments[0]?.fakeNitroNode?.fake)${rest}fakeNitroNode:arguments[0]?.fakeNitroNode,`
}
}
],
@@ -611,18 +624,18 @@ export default definePlugin({
return link.target && fakeNitroEmojiRegex.test(link.target);
},
- addFakeNotice(type: "STICKER" | "EMOJI", node: Array<ReactNode>, fake: boolean) {
+ addFakeNotice(type: FakeNoticeType, node: Array<ReactNode>, fake: boolean) {
if (!fake) return node;
node = Array.isArray(node) ? node : [node];
switch (type) {
- case "STICKER": {
+ case FakeNoticeType.Sticker: {
node.push(" This is a FakeNitro sticker and renders like a real sticker only for you. Appears as a link to non-plugin users.");
return node;
}
- case "EMOJI": {
+ case FakeNoticeType.Emoji: {
node.push(" This is a FakeNitro emoji and renders like a real emoji only for you. Appears as a link to non-plugin users.");
return node;