Update nitroBypass.ts (#132)

This commit is contained in:
jue131 2022-10-21 20:37:53 +09:00 committed by GitHub
parent ccf7f66a79
commit e93111fb67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;