diff options
author | Vendicated <vendicated@riseup.net> | 2022-10-01 17:04:57 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-10-01 17:04:57 +0200 |
commit | be94dbbc6c7a26f5cf44408c25ce1072c3c4f675 (patch) | |
tree | e01043064e894058f6eef13a93356ab91efbd31e /src/plugins | |
parent | 967b101af1a36437ea66d4aed575816a098c8009 (diff) | |
download | Vencord-be94dbbc6c7a26f5cf44408c25ce1072c3c4f675.tar.gz Vencord-be94dbbc6c7a26f5cf44408c25ce1072c3c4f675.tar.bz2 Vencord-be94dbbc6c7a26f5cf44408c25ce1072c3c4f675.zip |
Fix NitroBypass
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/nitroBypass.ts | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts index ebed095..cd77704 100644 --- a/src/plugins/nitroBypass.ts +++ b/src/plugins/nitroBypass.ts @@ -2,9 +2,10 @@ import { addPreSendListener, addPreEditListener, SendListener, removePreSendList import { findByProps } from "../webpack"; import definePlugin from "../utils/types"; import { Devs } from '../utils/constants'; +import { UserStore } from '../webpack/common'; export default definePlugin({ - name: "Nitro Bypass", + name: "NitroBypass", authors: [Devs.Arjix], description: "Allows you to stream in nitro quality and send fake emojis.", dependencies: ["MessageEventsAPI"], @@ -22,21 +23,33 @@ export default definePlugin({ }; }) }, + { + find: "STREAM_FPS_OPTION.format", + replacement: { + match: /(userPremiumType|guildPremiumTier):.{0,10}TIER_\d,?/g, + replace: "" + } + } ], + get guildId() { + return window.location.href.split("channels/")[1].split("/")[0]; + }, + + get canUseEmotes() { + return Boolean(UserStore.getCurrentUser().premiumType); + }, + start() { - const { getCustomEmojiById } = findByProps("getCustomEmojiById"); + if (this.canUseEmotes) { + console.info("[NitroBypass] Skipping start because you have nitro"); + return; + } - // Remove any nitro requirements for any of the streaming settings. - findByProps("ApplicationStreamPresets") - .ApplicationStreamSettingRequirements - .forEach(x => { - delete x.userPremiumType; - delete x.guildPremiumTier; - }); + const { getCustomEmojiById } = findByProps("getCustomEmojiById"); this.preSend = addPreSendListener((_, messageObj) => { - const guildId = window.location.href.split("channels/")[1].split("/")[0]; + const guildId = this.guildId; for (const emoji of messageObj.validNonShortcutEmojis) { if (!emoji.require_colons) continue; if (emoji.guildId === guildId && !emoji.animated) continue; @@ -46,8 +59,9 @@ export default definePlugin({ messageObj.content = messageObj.content.replace(emojiString, ` ${url} `); } }); + this.preEdit = addPreEditListener((_, __, messageObj) => { - const guildId = window.location.href.split("channels/")[1].split("/")[0]; + const guildId = this.guildId; for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) { const emoji = getCustomEmojiById(emojiId); |