2022-08-31 14:53:36 -04:00
|
|
|
import { addPreSendListener, addPreEditListener } from "../api/MessageEvents";
|
2022-08-31 14:55:58 -04:00
|
|
|
import { findByProps } from "../webpack";
|
|
|
|
import definePlugin from "../utils/types";
|
2022-08-31 14:53:36 -04:00
|
|
|
|
|
|
|
export default definePlugin({
|
|
|
|
name: "Nitro Bypass",
|
|
|
|
author: "ArjixWasTaken",
|
|
|
|
description: "Allows you to stream in nitro quality and send fake emojis.",
|
2022-08-31 14:58:21 -04:00
|
|
|
dependencies: ["MessageEventsAPI"],
|
2022-08-31 14:53:36 -04:00
|
|
|
patches: [
|
|
|
|
{
|
|
|
|
find: `canUseAnimatedEmojis:function`,
|
|
|
|
replacement: [
|
|
|
|
"canUseAnimatedEmojis",
|
|
|
|
"canUseEmojisEverywhere",
|
|
|
|
"canUseHigherFramerate"
|
|
|
|
].map(func => {
|
|
|
|
return {
|
|
|
|
match: new RegExp(`${func}:function\\(.+?}`),
|
|
|
|
replace: `${func}:function (e) { return true; }`
|
2022-08-31 14:55:58 -04:00
|
|
|
};
|
2022-08-31 14:53:36 -04:00
|
|
|
})
|
|
|
|
},
|
|
|
|
],
|
|
|
|
start() {
|
|
|
|
const { getCustomEmojiById } = findByProps("getCustomEmojiById");
|
|
|
|
|
|
|
|
// Remove any nitro requirements for any of the streaming settings.
|
|
|
|
findByProps("ApplicationStreamPresets")
|
2022-08-31 14:55:58 -04:00
|
|
|
.ApplicationStreamSettingRequirements
|
|
|
|
.forEach(x => {
|
|
|
|
delete x.userPremiumType;
|
|
|
|
delete x.guildPremiumTier;
|
|
|
|
});
|
2022-08-31 14:53:36 -04:00
|
|
|
|
|
|
|
addPreSendListener((_, messageObj) => {
|
|
|
|
const guildId = window.location.href.split("channels/")[1].split("/")[0];
|
|
|
|
for (const emoji of messageObj.validNonShortcutEmojis) {
|
|
|
|
if (!emoji.require_colons) continue;
|
|
|
|
if (emoji.guildId === guildId && !emoji.animated) continue;
|
|
|
|
|
|
|
|
const emojiString = `<${emoji.animated ? 'a' : ''}:${emoji.originalName || emoji.name}:${emoji.id}>`;
|
|
|
|
const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`);
|
|
|
|
messageObj.content = messageObj.content.replace(emojiString, ` ${url} `);
|
|
|
|
}
|
2022-08-31 14:55:58 -04:00
|
|
|
});
|
2022-08-31 14:53:36 -04:00
|
|
|
addPreEditListener((_, __, messageObj) => {
|
|
|
|
const guildId = window.location.href.split("channels/")[1].split("/")[0];
|
|
|
|
|
|
|
|
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
|
|
|
const emoji = getCustomEmojiById(emojiId);
|
|
|
|
if (emoji == null || (emoji.guildId === guildId && !emoji.animated)) continue;
|
|
|
|
|
|
|
|
const url = emoji.url.replace(/\?size=[0-9]+/, `?size=48`);
|
|
|
|
messageObj.content = messageObj.content.replace(emojiStr, ` ${url} `);
|
|
|
|
}
|
2022-08-31 14:55:58 -04:00
|
|
|
});
|
2022-08-31 14:53:36 -04:00
|
|
|
},
|
2022-08-31 14:55:58 -04:00
|
|
|
});
|