diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts index a013dd6c..b01a4845 100644 --- a/src/plugins/nitroBypass.ts +++ b/src/plugins/nitroBypass.ts @@ -1,8 +1,9 @@ import { addPreSendListener, addPreEditListener, removePreSendListener, removePreEditListener } from "../api/MessageEvents"; import { findByProps } from "../webpack"; -import definePlugin from "../utils/types"; +import definePlugin, { OptionType } from "../utils/types"; import { Devs } from "../utils/constants"; import { UserStore } from "../webpack/common"; +import { Settings } from "../Vencord"; export default definePlugin({ name: "NitroBypass", @@ -12,9 +13,21 @@ export default definePlugin({ patches: [ { find: "canUseAnimatedEmojis:function", + predicate: () => Settings.plugins.NitroBypass.enableEmojiBypass === true, replacement: [ "canUseAnimatedEmojis", - "canUseEmojisEverywhere", + "canUseEmojisEverywhere" + ].map(func => { + return { + match: new RegExp(`${func}:function\\(.+?}`), + replace: `${func}:function (e) { return true; }` + }; + }) + }, + { + find: "canUseAnimatedEmojis:function", + predicate: () => Settings.plugins.NitroBypass.enableStreamQualityBypass === true, + replacement: [ "canUseHighVideoUploadQuality", "canStreamHighQuality", "canStreamMidQuality" @@ -27,12 +40,27 @@ export default definePlugin({ }, { find: "STREAM_FPS_OPTION.format", + predicate: () => Settings.plugins.NitroBypass.enableStreamQualityBypass === true, replacement: { match: /(userPremiumType|guildPremiumTier):.{0,10}TIER_\d,?/g, replace: "" } } ], + options: { + enableEmojiBypass: { + description: "Allow sending fake emojis", + type: OptionType.BOOLEAN, + default: true, + restartNeeded: true, + }, + enableStreamQualityBypass: { + description: "Allow streaming in nitro quality", + type: OptionType.BOOLEAN, + default: true, + restartNeeded: true, + } + }, get guildId() { return window.location.href.split("channels/")[1].split("/")[0]; @@ -43,6 +71,10 @@ export default definePlugin({ }, start() { + if (!Settings.plugins.NitroBypass.enableEmojiBypass) { + return; + } + if (this.canUseEmotes) { console.info("[NitroBypass] Skipping start because you have nitro"); return;