diff options
author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-02-15 22:00:09 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 02:00:09 +0100 |
commit | 60ccd8cc25d86f10a166a31faf1cb996deb74621 (patch) | |
tree | a9a8858edd023b8c78b6190d0ed8c87a3aafc45a | |
parent | 5c1519156b5cd7e513fd1bfbc71ed263858c5885 (diff) | |
download | Vencord-60ccd8cc25d86f10a166a31faf1cb996deb74621.tar.gz Vencord-60ccd8cc25d86f10a166a31faf1cb996deb74621.tar.bz2 Vencord-60ccd8cc25d86f10a166a31faf1cb996deb74621.zip |
Various plugin fixes (#492)
Co-authored-by: Ven <vendicated@riseup.net>
-rw-r--r-- | src/plugins/fakeNitro.ts | 38 | ||||
-rw-r--r-- | src/plugins/showHiddenChannels/index.tsx | 2 | ||||
-rw-r--r-- | src/plugins/vcDoubleClick.ts | 6 | ||||
-rw-r--r-- | src/plugins/whoReacted.tsx | 7 |
4 files changed, 40 insertions, 13 deletions
diff --git a/src/plugins/fakeNitro.ts b/src/plugins/fakeNitro.ts index e5ac3b9..dd8ff19 100644 --- a/src/plugins/fakeNitro.ts +++ b/src/plugins/fakeNitro.ts @@ -27,6 +27,17 @@ import { ChannelStore, UserStore } from "@webpack/common"; const DRAFT_TYPE = 0; const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR"); +enum EmojiIntentions { + REACTION = 0, + STATUS = 1, + COMMUNITY_CONTENT = 2, + CHAT = 3, + GUILD_STICKER_RELATED_EMOJI = 4, + GUILD_ROLE_BENEFIT_EMOJI = 5, + COMMUNITY_CONTENT_ONLY = 6, + SOUNDBOARD = 7 +} + interface BaseSticker { available: boolean; description: string; @@ -64,17 +75,26 @@ export default definePlugin({ patches: [ { - find: "canUseAnimatedEmojis:function", + find: ".PREMIUM_LOCKED;", predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true, replacement: [ - "canUseAnimatedEmojis", - "canUseEmojisEverywhere" - ].map(func => { - return { - match: new RegExp(`${func}:function\\(.+?\\{`), - replace: "$&return true;" - }; - }) + { + match: /(?<=(?<intention>\i)=\i\.intention.+?\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g, + replace: ",$<intention>" + }, + { + match: /(?<=,\i=)\i\.\i\.can\(\i\.\i\.USE_EXTERNAL_EMOJIS,\i\)(?=;)/, + replace: "true" + } + ] + }, + { + find: "canUseAnimatedEmojis:function", + predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true, + replacement: { + match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\(\i)\){/g, + replace: `,fakeNitroIntention){return fakeNitroIntention===undefined||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention);` + } }, { find: "canUseAnimatedEmojis:function", diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index a4c7dec..fe14fe6 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -263,7 +263,7 @@ export default definePlugin({ replacement: [ { // Remove the divider and the open chat button for the HiddenChannelLockScreen - match: /(?<=function \i\((?<props>\i)\).{1,1800}"more-options-popout"\)\);if\()/, + match: /(?<=function \i\((?<props>\i)\).{1,2000}"more-options-popout"\)\);if\()/, replace: "(!$self.isHiddenChannel($<props>.channel)||$<props>.inCall)&&" }, { diff --git a/src/plugins/vcDoubleClick.ts b/src/plugins/vcDoubleClick.ts index 39b8a05..64c676c 100644 --- a/src/plugins/vcDoubleClick.ts +++ b/src/plugins/vcDoubleClick.ts @@ -48,10 +48,10 @@ export default definePlugin({ }, { // channel mentions - find: 'className:"channelMention",iconType:(', + find: ".EMOJI_IN_MESSAGE_HOVER", replacement: { - match: /onClick:(.{1,3}),/, - replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)(),", + match: /onClick:(\i)(?=,.{0,30}className:"channelMention")/, + replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)()", } } ], diff --git a/src/plugins/whoReacted.tsx b/src/plugins/whoReacted.tsx index a260bac..8ab1c5f 100644 --- a/src/plugins/whoReacted.tsx +++ b/src/plugins/whoReacted.tsx @@ -121,6 +121,13 @@ export default definePlugin({ const reactions = getReactionsWithQueue(message, emoji, type); const users = Object.values(reactions).filter(Boolean) as User[]; + for (const user of users) { + FluxDispatcher.dispatch({ + type: "USER_UPDATE", + user + }); + } + return ( <div style={{ marginLeft: "0.5em", transform: "scale(0.9)" }} |