buzzk 2.1.1 → 2.1.3
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 +8 -13
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -18,13 +18,12 @@ class chzzkChatData {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
class chzzkDonationData {
|
|
21
|
-
constructor(type, amount, id, name,
|
|
21
|
+
constructor(type, amount, id, name, message, emojis) {
|
|
22
22
|
this.type = type;
|
|
23
23
|
this.amount = amount;
|
|
24
24
|
this.author = {
|
|
25
25
|
id: id,
|
|
26
|
-
name: name
|
|
27
|
-
hasMod: hasMod
|
|
26
|
+
name: name
|
|
28
27
|
};
|
|
29
28
|
this.message = message;
|
|
30
29
|
this.emojis = emojis;
|
|
@@ -110,9 +109,11 @@ class chzzkChat {
|
|
|
110
109
|
console.log(data);
|
|
111
110
|
|
|
112
111
|
let hasMod = false;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
if (data.profile || data.profile.badges) {
|
|
113
|
+
for (let o in data.profile.badges) {
|
|
114
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
|
|
115
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
|
|
116
|
+
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
let chatData = new chzzkChatData(data.senderChannelId, data.profile.nickname, hasMod, data.content, data.emojis, data.messageTime);
|
|
@@ -124,13 +125,7 @@ class chzzkChat {
|
|
|
124
125
|
data = JSON.parse(data);
|
|
125
126
|
console.log(data);
|
|
126
127
|
|
|
127
|
-
let
|
|
128
|
-
for (let o in data.profile.badges) {
|
|
129
|
-
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
|
|
130
|
-
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, hasMod, data.donationText, data.emojis);
|
|
128
|
+
let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, data.donationText, data.emojis);
|
|
134
129
|
return this.#callbacks.donation(donationData);
|
|
135
130
|
});
|
|
136
131
|
|