buzzk 2.1.0 → 2.1.2
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/README.md +4 -1
- package/lib/chat.js +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
|
|
50
50
|
buzzkChat.onMessage
|
|
51
51
|
|
|
52
|
+
> 채팅 여러개를 한 번에 받던 구조 (data[o].message) (for 문으로 data[o] 돌리던 구조)에서
|
|
53
|
+
> 채팅 하나 씩 받는 구조로 변경 (data.message)
|
|
54
|
+
|
|
52
55
|
| <img src="https://github.com/Emin-G/Img/blob/main/tags/tag_delete-min.png?raw=true" alt="BUZZK" width="70"> | 삭제 |
|
|
53
56
|
|--|--|
|
|
54
57
|
| | (callback).author.imageURL |
|
|
@@ -143,7 +146,7 @@
|
|
|
143
146
|
|
|
144
147
|
let oauth = buzzk.oauth.get("code 값");
|
|
145
148
|
|
|
146
|
-
let chat = new buzzkChat(oauth.
|
|
149
|
+
let chat = new buzzkChat(oauth.access);
|
|
147
150
|
await chat.connect(); //채팅창 연결
|
|
148
151
|
|
|
149
152
|
chat.onMessage(async (data) => { //채팅이 왔을 때
|
package/lib/chat.js
CHANGED
|
@@ -110,12 +110,15 @@ class chzzkChat {
|
|
|
110
110
|
console.log(data);
|
|
111
111
|
|
|
112
112
|
let hasMod = false;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
if (data.profile || data.profile.badges) {
|
|
114
|
+
for (let o in data.profile.badges) {
|
|
115
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
|
|
116
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
|
|
117
|
+
}
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
let chatData = new chzzkChatData(data.senderChannelId, data.profile.nickname, hasMod, data.content, data.emojis, data.messageTime);
|
|
121
|
+
if (!this.#callbacks.message) return;
|
|
119
122
|
return this.#callbacks.message(chatData);
|
|
120
123
|
});
|
|
121
124
|
|
|
@@ -124,9 +127,11 @@ class chzzkChat {
|
|
|
124
127
|
console.log(data);
|
|
125
128
|
|
|
126
129
|
let hasMod = false;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
if (data.profile || data.profile.badges) {
|
|
131
|
+
for (let o in data.profile.badges) {
|
|
132
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
|
|
133
|
+
if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
|
|
134
|
+
}
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, hasMod, data.donationText, data.emojis);
|