-
Notifications
You must be signed in to change notification settings - Fork 144
/
NitroEmoteAndScreenShareBypass.plugin.js
162 lines (153 loc) · 4.56 KB
/
NitroEmoteAndScreenShareBypass.plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/**
* @name NitroEmoteAndScreenShareBypass
* @author oSumAtrIX
* @authorId 737323631117598811
* @version 4.3
* @description Send Nitro emojis and enable high quality screen sharing without Discord Nitro.
* @website https://osumatrix.me
* @source https://github.com/oSumAtrIX/BetterDiscordPlugins
* @updateUrl https://raw.githubusercontent.com/oSumAtrIX/BetterDiscordPlugins/master/NitroEmoteAndScreenShareBypass.plugin.js
*/
module.exports = (() => {
const config = {
info: {
name: "NitroEmoteAndScreenShareBypass",
authors: [
{
name: "oSumAtrIX",
discord_id: "737323631117598811",
github_username: "oSumAtrIX",
},
],
version: "4.3",
description:
"Send Nitro emojis and enable high quality screen sharing without Discord Nitro.",
github: "https://github.com/oSumAtrIX/BetterDiscordPlugins",
github_raw:
"https://raw.githubusercontent.com/oSumAtrIX/BetterDiscordPlugins/master/NitroEmoteAndScreenShareBypass.plugin.js",
},
main: "NitroEmoteAndScreenShareBypass.plugin.js",
};
return !global.ZeresPluginLibrary
? class {
constructor() {
this._config = config;
}
getName() {
return config.info.name;
}
getAuthor() {
return config.info.authors.map((a) => a.name).join(", ");
}
getDescription() {
return config.info.description;
}
getVersion() {
return config.info.version;
}
load() {
BdApi.showConfirmationModal(
"Library Missing",
`The library plugin needed for ${config.info.name} is missing. Please click Download Now to install it.`,
{
confirmText: "Download Now",
cancelText: "Cancel",
onConfirm: () => {
require("request").get(
"https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js",
async (error, response, body) => {
if (error)
return require("electron").shell.openExternal(
"https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js"
);
await new Promise((r) =>
require("fs").writeFile(
require("path").join(
BdApi.Plugins.folder,
"0PluginLibrary.plugin.js"
),
body,
r
)
);
}
);
},
}
);
}
start() {}
stop() {}
}
: (([Plugin, Api]) => {
const plugin = (Plugin, Api) => {
const { Patcher, DiscordModules, Settings, PluginUtilities } = Api;
return class NitroEmoteAndScreenShareBypass extends Plugin {
settings = PluginUtilities.loadSettings(this.getName(), {
size: 48,
});
getSettingsPanel() {
return Settings.SettingPanel.build(
(_) =>
PluginUtilities.saveSettings(this.getName(), this.settings),
...[
new Settings.Slider(
"Emoji size",
"Chose the size of emojis.",
16,
128,
this.settings.size,
(size) => (this.settings.size = size),
{
markers: [16, 20, 32, 48, 64, 128],
stickToMarkers: true,
}
),
]
);
}
onStart() {
// Spoof client side Discord Nitro.
let tries = 1;
let intervalId = setInterval(() => {
if (++tries > 5) clearInterval(intervalId);
const user =
ZeresPluginLibrary.DiscordModules.UserStore.getCurrentUser();
if (!user) return;
user.premiumType = 2;
clearInterval(intervalId);
}, 1000);
Patcher.before(
DiscordModules.MessageActions,
"sendMessage",
(_, [, message]) => {
const emojis = message.validNonShortcutEmojis;
emojis.forEach((emoji) => {
// Skip Discord emojis.
if (!emoji.require_colons) return;
// Construct the emoji string in the original message.
const emojiString = `<${emoji.animated ? "a" : ""}:${
emoji.name
}:${emoji.id}>`;
let url =
"https://cdn.discordapp.com/emojis/" +
emoji.id +
"." +
(emoji.animated ? "gif" : "webp") +
"?size=" +
this.settings.size;
// Replace the message containing the emoji string with the URL.
message.content = message.content.replace(emojiString, url);
});
}
);
}
onStop() {
Patcher.unpatchAll();
}
};
};
return plugin(Plugin, Api);
})(global.ZeresPluginLibrary.buildPlugin(config));
})();
/*@end@*/