This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
58 lines (49 loc) · 2.02 KB
/
index.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
import { findByProps } from '@goosemod/webpack';
import * as patcher from '@goosemod/patcher';
import { createItem, removeItem } from '@goosemod/settings';
import getEmojiLinks from './utils';
let settings = { emojisize: '64', emoji_extension: "webp" };
const usabilityCheck = findByProps('canUseEmojisEverywhere', 'canUseAnimatedEmojis');
const messageEvents = findByProps('sendMessage');
const Unpatch = { animatedCheck: null, emojiCheck: null, sendMessage: null };
export default {
goosemodHandlers: {
onImport: async () => {
Unpatch.emojiCheck = patcher.patch(usabilityCheck, "canUseEmojisEverywhere", () => {
return true;
});
Unpatch.animatedCheck = patcher.patch(usabilityCheck, "canUseAnimatedEmojis", () => {
return true;
});
Unpatch.sendMessage = patcher.patch(messageEvents, "sendMessage", (args) => {
if (args[1].content.match(/<a?:(\w+):(\d+)>/i) != null) {
getEmojiLinks(settings.emojisize, args, settings.emoji_extension);
}
});
createItem('Nitro Spoof', ['',
{
type: 'text-input',
text: 'Emoji Size',
initialValue: () => settings.emojisize,
oninput: (value) => {
settings.emojisize = value;
},
},
{
type: 'text-input',
text: 'Emoji Extension (webp, png)',
initialValue: () => settings.emoji_extension,
oninput: (value) => {
settings.emoji_extension = value;
},
},
]);
},
getSettings: () => [settings],
loadSettings: ([_settings]) => { settings = _settings },
onRemove: async () => {
Object.values(Unpatch).forEach(unpatch => unpatch());
removeItem('Nitro Spoof');
}
},
};