aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorArjixWasTaken <53124886+ArjixWasTaken@users.noreply.github.com>2022-08-31 21:53:36 +0300
committerGitHub <noreply@github.com>2022-08-31 20:53:36 +0200
commitc3ff092162ef1a98bea78213e473be3207998d72 (patch)
tree96b5f04944064c7021cdd60e1b44e3bade2aacc2 /src/plugins
parenta7ccbcfca4f181790b86199a7f31d1ae19e0253f (diff)
downloadVencord-c3ff092162ef1a98bea78213e473be3207998d72.tar.gz
Vencord-c3ff092162ef1a98bea78213e473be3207998d72.tar.bz2
Vencord-c3ff092162ef1a98bea78213e473be3207998d72.zip
Add nitro bypass (#4)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/apiMessageClicks.ts16
-rw-r--r--src/plugins/apiMessageEvents.ts28
-rw-r--r--src/plugins/messageActions.ts4
-rw-r--r--src/plugins/nitroBypass.ts58
4 files changed, 88 insertions, 18 deletions
diff --git a/src/plugins/apiMessageClicks.ts b/src/plugins/apiMessageClicks.ts
deleted file mode 100644
index 7155b94..0000000
--- a/src/plugins/apiMessageClicks.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import definePlugin from "../utils/types";
-
-export default definePlugin({
- name: "MessageClicksApi",
- description: "Api required by anything using message click actions",
- author: "Vendicated",
- patches: [{
- find: "if(e.altKey){",
- replacement: {
- match: /\.useClickMessage=function\((.{1,2}),(.{1,2})\).+?function\((.{1,2})\){/,
- replace: (m, message, channel, event) =>
- // the message param is shadowed by the event param, so need to alias them
- `${m.replace("{", `{var _msg=${message};var _chan=${channel};`)}Vencord.Api.MessageClicks._handleClick(_msg, _chan, ${event});`
- }
- }]
-});
diff --git a/src/plugins/apiMessageEvents.ts b/src/plugins/apiMessageEvents.ts
new file mode 100644
index 0000000..79acd32
--- /dev/null
+++ b/src/plugins/apiMessageEvents.ts
@@ -0,0 +1,28 @@
+import definePlugin from "../utils/types";
+
+export default definePlugin({
+ name: "MessageEventsAPI",
+ description: "Api required by anything using message events.",
+ author: "ArjixWasTaken",
+ patches: [
+ {
+ find: "sendMessage:function",
+ replacement: [{
+ match: /(?<=sendMessage:function\(.{1,2},.{1,2},.{1,2},.{1,2}\)){/,
+ replace: "{Vencord.Api.MessageEvents._handlePreSend(...arguments);"
+ }, {
+ match: /(?<=editMessage:function\(.{1,2},.{1,2},.{1,2}\)){/,
+ replace: "{Vencord.Api.MessageEvents._handlePreEdit(...arguments);"
+ }]
+ },
+ {
+ find: "if(e.altKey){",
+ replacement: {
+ match: /\.useClickMessage=function\((.{1,2}),(.{1,2})\).+?function\((.{1,2})\){/,
+ replace: (m, message, channel, event) =>
+ // the message param is shadowed by the event param, so need to alias them
+ `${m.replace("{", `{var _msg=${message};var _chan=${channel};`)}Vencord.Api.MessageEvents._handleClick(_msg, _chan, ${event});`
+ }
+ }
+ ]
+});
diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts
index 5519cf7..88e625e 100644
--- a/src/plugins/messageActions.ts
+++ b/src/plugins/messageActions.ts
@@ -1,4 +1,4 @@
-import { MessageClicks } from "../api";
+import { addClickListener } from "../api/MessageEvents";
import definePlugin from "../utils/types";
import { find, findByProps } from "../webpack";
@@ -21,7 +21,7 @@ export default definePlugin({
if (e.key === "Backspace") isDeletePressed = false;
});
- MessageClicks.addListener((msg, chan, event) => {
+ addClickListener((msg, chan, event) => {
const isMe = msg.author.id === getCurrentUser().id;
if (!isDeletePressed) {
if (isMe && event.detail >= 2) {
diff --git a/src/plugins/nitroBypass.ts b/src/plugins/nitroBypass.ts
new file mode 100644
index 0000000..25c1aa6
--- /dev/null
+++ b/src/plugins/nitroBypass.ts
@@ -0,0 +1,58 @@
+import { addPreSendListener, addPreEditListener } from "../api/MessageEvents";
+import { findByProps } from "../utils/webpack";
+import definePlugin from "../utils/types"
+
+export default definePlugin({
+ name: "Nitro Bypass",
+ author: "ArjixWasTaken",
+ description: "Allows you to stream in nitro quality and send fake emojis.",
+ patches: [
+ {
+ find: `canUseAnimatedEmojis:function`,
+ replacement: [
+ "canUseAnimatedEmojis",
+ "canUseEmojisEverywhere",
+ "canUseHigherFramerate"
+ ].map(func => {
+ return {
+ match: new RegExp(`${func}:function\\(.+?}`),
+ replace: `${func}:function (e) { return true; }`
+ }
+ })
+ },
+ ],
+ start() {
+ const { getCustomEmojiById } = findByProps("getCustomEmojiById");
+
+ // Remove any nitro requirements for any of the streaming settings.
+ findByProps("ApplicationStreamPresets")
+ .ApplicationStreamSettingRequirements
+ .forEach(x => {
+ delete x.userPremiumType;
+ delete x.guildPremiumTier
+ });
+
+ 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} `);
+ }
+ })
+ 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} `);
+ }
+ })
+ },
+})