Fix bug where nitro would not be applied if plugin was loaded before currentUser is available

This commit is contained in:
Yuki 2022-03-03 09:40:25 +01:00
parent 223932bf28
commit fc13e6c345
No known key found for this signature in database
GPG Key ID: 83A53A8C412E93F5

@ -16,7 +16,17 @@ module.exports = class NitroBypass extends Plugin {
const currentUser = await getModule(['getCurrentUser']);
// spoof client side premium
currentUser.getCurrentUser().premiumType = 2;
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 1s...");
}
}, 1000);
const emojiReplacePatch = this.emojiReplacePatch.bind(this);
inject('replace-on-send', message, 'sendMessage', emojiReplacePatch, true);