emotesjs 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +14 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -15,8 +15,8 @@ class EmotesJS {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (opts) {
|
|
18
|
-
this.channelId = opts.channelId
|
|
19
|
-
this.requireColon = opts.requireColon
|
|
18
|
+
this.channelId = opts.channelId
|
|
19
|
+
this.requireColon = opts.requireColon
|
|
20
20
|
this.height = opts.height || this.height
|
|
21
21
|
this.format = opts.format || this.format
|
|
22
22
|
}
|
|
@@ -89,20 +89,24 @@ class EmotesJS {
|
|
|
89
89
|
for (let i = 0; i < words.length; i++) {
|
|
90
90
|
let word = words[i]
|
|
91
91
|
|
|
92
|
-
if (this.requireColon && word.startsWith(":")) {
|
|
93
|
-
let wordKey = word.replace(':', '')
|
|
94
|
-
let emote = this.cachedEmotes.get(wordKey)
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (this.requireColon && !word.startsWith(":")) {
|
|
94
|
+
fullText += word + " "
|
|
95
|
+
continue
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let wordKey = word.replaceAll(':', '')
|
|
99
|
+
let emote = this.cachedEmotes.get(wordKey)
|
|
100
|
+
|
|
101
|
+
if (emote) {
|
|
102
|
+
fullText += emote + ' '
|
|
103
|
+
continue;
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
fullText += word + " "
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
return fullText
|
|
109
|
+
return fullText.trim()
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
}
|