-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmojiStealer.plugin.js
119 lines (94 loc) · 2.45 KB
/
EmojiStealer.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
/**
* @name EmojiStealer
* @authorLink https://github.com/AffinityGH
* @website https://stjarna.cf
*/
module.exports = (() =>
{
const config =
{
info:
{
name: "EmojiStealer",
authors:
[
{
name: "Affinity",
discord_id: "411212714707386389",
github_username: "AffinityGH"
}
],
version: "1.0.1",
description: "Copy the URL of any emoji and call it using a simple command, allowing you to use emojis at will."
},
changelog:
[
{
title: "1.0.1",
type: "added",
items:
[
"Made the emoji sizes 64x64 pixels"
]
}
]
};
return (([Plugin, Api]) => {
const plugin = (Plugin, Api) =>
{
const { DiscordModules, Patcher } = Api;
return class EmojiStealer extends Plugin
{
constructor()
{
super();
}
onStart()
{
Patcher.after(DiscordModules.MessageActions, "sendMessage", (_, [, message]) =>
{
const content = message.content.toLowerCase();
switch (content.split("$")[0])
{
case "steal":
const link = (/^steal\$ /g).exec(content);
const pieces = message.content.substr(link[0].length, message.content.length).split(" ")
if (pieces.length > 2){
message.content = ("Error. More than two fields detected.")
break;
}
const name = pieces[0]
const url = pieces[1]
BdApi.saveData("EmojiStealer", name, url)
message.content = ("Success")
break;
case "e":
const data = (/^e\$ /g).exec(content);
const key = message.content.substr(data[0].length, message.content.length).split(" ")
if (key.length > 1){
message.content = ("Error. More than one field detected.")
break;
}
const emojiUrl = BdApi.loadData("EmojiStealer", key[0]);
message.content = (emojiUrl + '&size=64');
case "es":
const es = (/^es\$ /g).exec(content);
const keyes = message.content.substr(es[0].length, message.content.length).split(" ")
if (keyes.length > 1){
message.content = ("Error. More than one field detected.")
break;
}
const emojiUrles = BdApi.loadData("EmojiStealer", keyes[0]);
message.content = (emojiUrles + '&size=32');
}
});
}
onStop()
{
Patcher.unpatchAll();
}
}
};
return plugin(Plugin, Api);
})(global.ZeresPluginLibrary.buildPlugin(config));
})();