From e93111fb67e415b0828418b23811152d7e4eee86 Mon Sep 17 00:00:00 2001 From: jue131 <83157668+jue131@users.noreply.github.com> Date: Fri, 21 Oct 2022 20:37:53 +0900 Subject: Update nitroBypass.ts (#132) --- src/plugins/nitroBypass.ts | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts index a013dd6..b01a484 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; -- cgit