buzzk 2.1.3 → 2.1.5
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/lib/chat.js +3 -2
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -105,6 +105,7 @@ class chzzkChat {
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
this.#ws.on("CHAT", (data) => {
|
|
108
|
+
if (!this.#callbacks.message) return;
|
|
108
109
|
data = JSON.parse(data);
|
|
109
110
|
console.log(data);
|
|
110
111
|
|
|
@@ -117,11 +118,11 @@ class chzzkChat {
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
let chatData = new chzzkChatData(data.senderChannelId, data.profile.nickname, hasMod, data.content, data.emojis, data.messageTime);
|
|
120
|
-
if (!this.#callbacks.message) return;
|
|
121
121
|
return this.#callbacks.message(chatData);
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
this.#ws.on("DONATION", (data) => {
|
|
125
|
+
if (!this.#callbacks.donation) return;
|
|
125
126
|
data = JSON.parse(data);
|
|
126
127
|
console.log(data);
|
|
127
128
|
|
|
@@ -140,7 +141,7 @@ class chzzkChat {
|
|
|
140
141
|
|
|
141
142
|
this.#status.ws = false;
|
|
142
143
|
this.#status.established = false;
|
|
143
|
-
this.#callbacks.disconnect(data);
|
|
144
|
+
if (this.#callbacks.disconnect) this.#callbacks.disconnect(data);
|
|
144
145
|
|
|
145
146
|
if (this.#ws) this.#ws.off();
|
|
146
147
|
if (!this.#status.established) resolve(null);
|