-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPolluxEmojiClass.js
37 lines (31 loc) · 1.04 KB
/
PolluxEmojiClass.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
const emojibank = require('./EmojiList');
const globalEmojis = [];
async function createShallowEmojiBank(PLX) {
PLX.guilds?.forEach(async (G) => {
G.emojis?.forEach(async (e) => {
globalEmojis.push(e);
});
});
}
function getShallowEmoji(identifier) {
const EMJ = globalEmojis.find((ge) => ge.id === identifier
|| ge.name === identifier
|| ge.name.toLowerCase() === identifier.toLowerCase());
if (!EMJ) return false;
EMJ.string = `<${EMJ.animated ? "a" : ""}:${EMJ.name}:${EMJ.id}>`;
return EMJ;
}
class PolluxEmoji extends String {
constructor(identifier, fallback) {
const print = emojibank[identifier]
|| getShallowEmoji(identifier).string
|| getShallowEmoji(fallback || "____").string
|| fallback
|| "⬜";
super(`${print} `);
this.reaction = print.replace("<:", "").replace("<a:", "").replace(">", "");
this.no_space = print.replace(/ +/g, "");
[this.name, this.id] = this.reaction.replace("a:", "").split(":");
}
}
module.exports = { PolluxEmoji, createShallowEmojiBank };