Refactor code

This commit is contained in:
oSumAtrIX 2022-03-06 23:54:13 +01:00 committed by GitHub
parent 81f69ccd9e
commit f237ce01df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
const { Plugin } = require('powercord/entities');
const { React, getModule } = require('powercord/webpack');
const { getModule } = require('powercord/webpack');
const { inject, uninject } = require('powercord/injector');
const Settings = require('./components/settings.jsx');
@ -16,24 +16,15 @@ module.exports = class NitroBypass extends Plugin {
const currentUser = await getModule(['getCurrentUser']);
// spoof client side premium
var tries = 0;
var maxTries = 5;
this.log("Checking for currentUser...");
var x = setInterval(() => {
var user = currentUser.getCurrentUser();
if(user != null) {
user.premiumType = 2;
this.log("Spoofed!");
clearInterval(x);
} else {
this.log("currentUser not found, retrying in 5s...");
}
if(tries > maxTries) {
this.error("Failed to find currentUser.");
clearInterval(x);
}
tries++;
}, 5000);
let tries = 1;
let intervalId = setInterval(() => {
if (++tries > 5) clearInterval(intervalId);
const user = currentUser.getCurrentUser();
if (!user) return;
user.premiumType = 2;
clearInterval(intervalId);
}, 1000);
const emojiReplacePatch = this.emojiReplacePatch.bind(this);
inject('replace-on-send', message, 'sendMessage', emojiReplacePatch, true);