buzzk 1.4.0 โ 1.5.1
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 +10 -19
- package/lib/chat.js +35 -3
- package/lib/live.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,27 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
## ๐ ์
๋ฐ์ดํธ ๋ด์ญ
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
- ์ฑํ
์ ์ฐ๊ฒฐํ์ง ๋ชปํ๋ ๋ฌธ์ ํด๊ฒฐ (UID๋ฅผ ์ ๊ฑธ๋ก ํด๋จ๋... ๋น๊ตฌ...)
|
|
20
|
+
- live.getDetail ํจ์์ Return ๊ฐ์ category ํญ๋ชฉ ์ถ๊ฐ
|
|
22
21
|
|
|
23
22
|
>
|
|
24
23
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
**ํ๋จ์ 1.3.0 ๋ง์ด๊ทธ๋ ์ด์
๊ฐ์ด๋ ์ฐธ๊ณ **
|
|
24
|
+
- ์ฑํ
์ฐฝ ์ฐ๊ฒฐ์ด ๋๊ธฐ๋ ๋ฌธ์ ํด๊ฒฐ (Ping ์ถ๊ฐ)
|
|
25
|
+
- ์ฑํ
์ฐฝ ID ๋ณ๊ฒฝ ์ ์ฌ์ฐ๊ฒฐ ๊ตฌํ
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
- ws ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ข
์์ฑ ์ถ๊ฐ
|
|
27
|
+
>
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
- onDisconnect ํจ์ ์ถ๊ฐ
|
|
30
|
+
- ์ฑํ
์ ์ฐ๊ฒฐํ์ง ๋ชปํ๋ ๋ฌธ์ ํด๊ฒฐ (UID๋ฅผ ์ ๊ฑธ๋ก ํด๋จ๋... ๋น๊ตฌ...)
|
|
31
|
+
- ํจ์ ์ด๋ฆ ์์
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
- ํ๋ก์ฐ / ์ธํ๋ก์ฐ ๊ธฐ๋ฅ ์ถ๊ฐ
|
|
36
|
-
- live.getLiveDetail์ Return ๊ฐ์ chatLimit ์ถ๊ฐ (ํ๋ก์ฐ ๋์ ์ฑํ
๋ฑ...)
|
|
37
|
-
- ํด๋ง ํจ์ ์ถ๊ฐ (chatID ๋ณ๊ฒฝ ๊ฐ์ง)
|
|
38
|
-
- API ํธ์ถ ์คํจ ์ ์ค๋ฅ ํธ๋ค๋ง (Return true / null)
|
|
39
|
-
- chat.disconnect ํจ์ ๋ณด์
|
|
40
|
-
- ๋ฒ์ ์ฒดํฌ ํจ์ ์ถ๊ฐ
|
|
33
|
+
**ํ๋จ์ 1.3.0 ๋ง์ด๊ทธ๋ ์ด์
๊ฐ์ด๋ ์ฐธ๊ณ **
|
|
41
34
|
|
|
42
35
|
## โ๏ธ ๋ง์ด๊ทธ๋ ์ด์
๊ฐ์ด๋ (v.1.3.0)
|
|
43
36
|
|
|
@@ -138,10 +131,7 @@
|
|
|
138
131
|
});
|
|
139
132
|
|
|
140
133
|
chat.onDisconnect(async () => { //์ฑํ
์ฐฝ ์ฐ๊ฒฐ์ด ๋๊ฒผ์ ๋
|
|
141
|
-
|
|
142
|
-
chat = new buzzkChat(channel.channelID);
|
|
143
|
-
await chat.connect();
|
|
144
|
-
//๋ค์ ์์ฑ ํ ์ฐ๊ฒฐ or liveStatus ํ์ธ ํ ๋ฐฉ์ก์ค์ด๋ฉด ์ฐ๊ฒฐ
|
|
134
|
+
//TODO
|
|
145
135
|
});
|
|
146
136
|
|
|
147
137
|
}
|
|
@@ -226,6 +216,7 @@ dotenv์ ํจ๊ป ์ฌ์ฉํ๋ ๊ฒ์ ๋งค์ฐ ๊ถ์ฅํฉ๋๋ค.
|
|
|
226
216
|
- now
|
|
227
217
|
- total
|
|
228
218
|
- title
|
|
219
|
+
- category
|
|
229
220
|
- startOn
|
|
230
221
|
- closeOn
|
|
231
222
|
- status
|
package/lib/chat.js
CHANGED
|
@@ -18,6 +18,7 @@ class chzzkChat {
|
|
|
18
18
|
#chatID;
|
|
19
19
|
|
|
20
20
|
#pollingStatus = false;
|
|
21
|
+
#pingStatus = false;
|
|
21
22
|
//Private
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -106,7 +107,10 @@ class chzzkChat {
|
|
|
106
107
|
//Ping Pong
|
|
107
108
|
|
|
108
109
|
//Connected
|
|
109
|
-
else if (data.cmd == 10100)
|
|
110
|
+
else if (data.cmd == 10100) {
|
|
111
|
+
if (!this.#pingStatus) this.#ping();
|
|
112
|
+
resolve(true);
|
|
113
|
+
}
|
|
110
114
|
//Connected
|
|
111
115
|
});
|
|
112
116
|
//WS Message
|
|
@@ -296,12 +300,40 @@ class chzzkChat {
|
|
|
296
300
|
|
|
297
301
|
//Get ChatID
|
|
298
302
|
let cidRes = await getStatus(this.channelID);
|
|
299
|
-
|
|
303
|
+
if (cidRes.chatID && cidRes.chatID != this.#chatID) {
|
|
304
|
+
this.#chatID = cidRes.chatID;
|
|
305
|
+
|
|
306
|
+
//Reconnect
|
|
307
|
+
this.#pollingStatus = false;
|
|
308
|
+
await this.disconnect();
|
|
309
|
+
await this.connect();
|
|
310
|
+
return;
|
|
311
|
+
//Reconnect
|
|
312
|
+
}
|
|
300
313
|
//Get ChatID
|
|
301
314
|
|
|
315
|
+
let interval;
|
|
316
|
+
if (cidRes.polling && cidRes.polling.callPeriodMilliSecond) interval = cidRes.polling.callPeriodMilliSecond;
|
|
317
|
+
else interval = 10000;
|
|
318
|
+
|
|
302
319
|
setTimeout(() => {
|
|
303
320
|
return this.#polling();
|
|
304
|
-
},
|
|
321
|
+
}, interval);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
async #ping () {
|
|
325
|
+
if (!this.#ws) return this.#pingStatus = false;
|
|
326
|
+
this.#pingStatus = true;
|
|
327
|
+
|
|
328
|
+
let pingOpt = {
|
|
329
|
+
"ver": "2",
|
|
330
|
+
"cmd": 0
|
|
331
|
+
};
|
|
332
|
+
this.#ws.send(JSON.stringify(pingOpt));
|
|
333
|
+
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
return this.#ping();
|
|
336
|
+
}, 20000);
|
|
305
337
|
}
|
|
306
338
|
}
|
|
307
339
|
|
package/lib/live.js
CHANGED
|
@@ -8,6 +8,7 @@ const { reqChzzk } = require("./tool.js");
|
|
|
8
8
|
* @property {string} chatLimit
|
|
9
9
|
* @property {userCount} userCount
|
|
10
10
|
* @property {string} title
|
|
11
|
+
* @property {string} category
|
|
11
12
|
* @property {string} startOn
|
|
12
13
|
* @property {string} closeOn
|
|
13
14
|
* @property {string} status
|
|
@@ -45,6 +46,7 @@ async function getDetail (channelID) {
|
|
|
45
46
|
chatLimit: res.chatAvailableGroup,
|
|
46
47
|
userCount: { now: res.concurrentUserCount, total: res.accumulateCount },
|
|
47
48
|
title: res.liveTitle,
|
|
49
|
+
category: res.liveCategoryValue,
|
|
48
50
|
startOn: res.openDate,
|
|
49
51
|
closeOn: res.closeDate,
|
|
50
52
|
status: res.status,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buzzk",
|
|
3
3
|
"displayName": "BUZZK",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.1",
|
|
5
5
|
"description": "๋ฟ์ง์ง (BUZZK) - ์น์ง์ง(CHZZK) ์ฑ๋ด์ ๋์ฑ ์ฝ๊ฒ ๊ฐ๋ฐํ ์ ์๋๋ก ๋๋ ๋น๊ณต์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ.",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"type": "commonjs",
|