buzzk 1.6.0 โ†’ 1.6.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 CHANGED
@@ -16,6 +16,10 @@
16
16
  ---
17
17
 
18
18
  ## ๐Ÿ“– ์—…๋ฐ์ดํŠธ ๋‚ด์—ญ
19
+
20
+ - chat.getUserInfo ํ•จ์ˆ˜ ์ถ”๊ฐ€
21
+
22
+ >
19
23
 
20
24
  - ๋ฐฉ์†ก ์‹œ์ž‘ ์‹œ onMessage ํ•จ์ˆ˜๊ฐ€ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ์ˆ˜์ •
21
25
 
@@ -28,15 +32,7 @@
28
32
  - ์ฑ„ํŒ…์ฐฝ ์—ฐ๊ฒฐ์ด ๋Š๊ธฐ๋˜ ๋ฌธ์ œ ํ•ด๊ฒฐ (Ping ์ถ”๊ฐ€)
29
33
  - ์ฑ„ํŒ…์ฐฝ ID ๋ณ€๊ฒฝ ์‹œ ์žฌ์—ฐ๊ฒฐ ๊ตฌํ˜„
30
34
 
31
- >
32
-
33
- - onDisconnect ํ•จ์ˆ˜ ์ถ”๊ฐ€
34
- - ์ฑ„ํŒ…์— ์—ฐ๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ๋˜ ๋ฌธ์ œ ํ•ด๊ฒฐ (UID๋ฅผ ์ œ๊ฑธ๋กœ ํ•ด๋†จ๋˜... ๋น™๊ตฌ...)
35
- - ํ•จ์ˆ˜ ์ด๋ฆ„ ์ˆ˜์ •
36
-
37
- **ํ•˜๋‹จ์˜ 1.3.0 ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๊ฐ€์ด๋“œ ์ฐธ๊ณ **
38
-
39
- ## โœ’๏ธ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๊ฐ€์ด๋“œ (v.1.3.0)
35
+ ## โœ’๏ธ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ๊ฐ€์ด๋“œ (v.1.2.x -> v.1.3.0)
40
36
 
41
37
  <details>
42
38
  <summary>ํŽผ์ณ๋ณด๊ธฐ</summary>
@@ -131,6 +127,10 @@
131
127
 
132
128
  if (data[o].message === "!ping") await chat.send("pong!");
133
129
  //์ฑ„ํŒ… ๋ณด๋‚ด๊ธฐ (login ํ›„์—๋งŒ ๊ฐ€๋Šฅ)
130
+
131
+ let userInfo = await chat.getUserInfo(data[o].author.id);
132
+ console.log(userInfo);
133
+ //์ฑ„ํŒ… ๋ณด๋‚ธ ์œ ์ €์˜ ์ •๋ณด
134
134
  }
135
135
  });
136
136
 
@@ -311,6 +311,20 @@ dotenv์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๋งค์šฐ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
311
311
 
312
312
  await chat.send("ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹"); //์ฑ„ํŒ… ๋ณด๋‚ด๊ธฐ (login ํ›„์—๋งŒ ๊ฐ€๋Šฅ)
313
313
 
314
- >
314
+ >
315
+
316
+ let userInfo = await chat.getUserInfo("์œ ์ €์˜ channelID ๊ฐ’");
317
+
318
+ <details>
319
+ <summary>return</summary>
320
+
321
+ - Return
322
+ - channelID
323
+ - name
324
+ - imageURL
325
+ - role //ex. streamer
326
+ - followDate //ํŒ”๋กœ์šฐ ๋‚ ์งœ ex. 2024-02-19 23:28:11
327
+
328
+ </details>
315
329
 
316
330
  await chat.disconnect(); //์ฑ„ํŒ…์ฐฝ ์—ฐ๊ฒฐ ๋Š๊ธฐ
package/lib/chat.js CHANGED
@@ -36,6 +36,7 @@ class chzzkChat {
36
36
 
37
37
  //Get ChatID
38
38
  let cidRes = await getStatus(this.channelID);
39
+ if (!cidRes) return resolve(null);
39
40
  this.#chatID = cidRes.chatID;
40
41
  //Get ChatID
41
42
 
@@ -348,7 +349,7 @@ class chzzkChat {
348
349
 
349
350
  //Get ChatID
350
351
  let cidRes = await getStatus(this.channelID);
351
- if (cidRes.chatID && cidRes.chatID != this.#chatID) {
352
+ if (cidRes && cidRes.chatID && cidRes.chatID != this.#chatID) {
352
353
  this.#chatID = cidRes.chatID;
353
354
 
354
355
  //Reconnect
@@ -364,7 +365,7 @@ class chzzkChat {
364
365
  //Get ChatID
365
366
 
366
367
  let interval;
367
- if (cidRes.polling && cidRes.polling.callPeriodMilliSecond) interval = cidRes.polling.callPeriodMilliSecond;
368
+ if (cidRes && cidRes.polling && cidRes.polling.callPeriodMilliSecond) interval = cidRes.polling.callPeriodMilliSecond;
368
369
  else interval = 10000;
369
370
 
370
371
  setTimeout(() => {
package/lib/tool.js CHANGED
@@ -10,7 +10,7 @@ function reqChzzk (path) {
10
10
  }
11
11
  })
12
12
 
13
- .then((response) => resolve(response.json()));
13
+ .then((response) => resolve(response.json())).catch((error) => resolve({"code": 500}));
14
14
 
15
15
  });
16
16
  }
@@ -25,7 +25,7 @@ function exChzzk (method, path) {
25
25
  }
26
26
  })
27
27
 
28
- .then((response) => resolve(response.json()));
28
+ .then((response) => resolve(response.json())).catch((error) => resolve({"code": 500}));
29
29
 
30
30
  });
31
31
  }
@@ -40,7 +40,7 @@ function reqGame (path) {
40
40
  }
41
41
  })
42
42
 
43
- .then((response) => resolve(response.json()));
43
+ .then((response) => resolve(response.json())).catch((error) => resolve({"code": 500}));
44
44
 
45
45
  });
46
46
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzk",
3
3
  "displayName": "BUZZK",
4
- "version": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "description": "๋ฟŒ์ง€์ง (BUZZK) - ์น˜์ง€์ง(CHZZK) ์ฑ—๋ด‡์„ ๋”์šฑ ์‰ฝ๊ฒŒ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋„๋ก ๋•๋Š” ๋น„๊ณต์‹ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ.",
6
6
  "main": "lib/index.js",
7
7
  "type": "commonjs",