buzzk 1.9.5 → 1.9.7

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.
Files changed (2) hide show
  1. package/lib/chat.js +23 -5
  2. package/package.json +36 -36
package/lib/chat.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const { getStatus } = require("./live.js");
2
2
  const { reqChzzk, reqGame } = require("./tool.js");
3
+ const vm = require("./vm.js");
3
4
 
4
5
  const { WebSocket } = require("ws");
5
6
 
@@ -83,7 +84,7 @@ class chzzkChat {
83
84
 
84
85
  //WS First Connect
85
86
  let connectOpt = {
86
- "ver": "2",
87
+ "ver": "3",
87
88
  "cmd": 100,
88
89
  "svcid": "game",
89
90
  "cid": this.#chatID,
@@ -91,7 +92,11 @@ class chzzkChat {
91
92
  "uid": this.#uid,
92
93
  "devType":2001,
93
94
  "accTkn": this.#accTkn,
94
- "auth":"SEND"
95
+ "auth":"SEND",
96
+ "devName": "BUZZK/" + vm.getVersion(),
97
+ "locale": "ko",
98
+ "osVer": "Windows/10",
99
+ "timezone": "Asia/Seoul"
95
100
  },
96
101
  "tid": 1
97
102
  };
@@ -106,7 +111,13 @@ class chzzkChat {
106
111
  this.#ws.on("close", () => {
107
112
  console.log("[WS] Disconnect!");
108
113
  this.#status.ws = false;
114
+ this.#status.wsID++;
109
115
  this.#status.ping = false;
116
+ this.#status.pingID++;
117
+ setTimeout(() => {
118
+ this.#status.reconnect = true;
119
+ this.connect();
120
+ }, 2000);
110
121
  });
111
122
 
112
123
  //WS Message
@@ -390,7 +401,7 @@ class chzzkChat {
390
401
  if (!this.#status.ws) return resolve(null);
391
402
 
392
403
  let reqOpt = {
393
- "ver": "2",
404
+ "ver": "3",
394
405
  "cmd": 5101,
395
406
  "svcid": this.#svcid,
396
407
  "cid": this.#chatID,
@@ -535,10 +546,17 @@ class chzzkChat {
535
546
  if (!this.#status.ping || pingID != this.#status.pingID) return;
536
547
 
537
548
  let pingOpt = {
538
- "ver": "2",
549
+ "ver": "3",
539
550
  "cmd": 0
540
551
  };
541
- if (this.#ws.readyState == WebSocket.OPEN) this.#ws.send(JSON.stringify(pingOpt));
552
+ try {
553
+ await this.#ws.send(JSON.stringify(pingOpt));
554
+ }
555
+ catch (error) {
556
+ return setTimeout(async () => {
557
+ return this.#ping(pingID);
558
+ }, 20000);
559
+ }
542
560
 
543
561
  setTimeout(() => {
544
562
  return this.#ping(pingID);
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "buzzk",
3
- "displayName": "BUZZK",
4
- "version": "1.9.5",
5
- "description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
6
- "main": "lib/index.js",
7
- "type": "commonjs",
8
- "directories": {
9
- "lib": "lib"
10
- },
11
- "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "author": {
15
- "name": "Emin-G",
16
- "email": "dev.mingowo@gmail.com"
17
- },
18
- "license": "MIT",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/Emin-G/buzzk.git"
22
- },
23
- "bugs": {
24
- "url": "https://github.com/Emin-G/buzzk/issues"
25
- },
26
- "homepage": "https://github.com/Emin-G/buzzk",
27
- "keywords": [
28
- "chzzk",
29
- "buzzk",
30
- "치지직",
31
- "뿌지직"
32
- ],
33
- "dependencies": {
34
- "ws": "^8.16.0"
35
- }
36
- }
1
+ {
2
+ "name": "buzzk",
3
+ "displayName": "BUZZK",
4
+ "version": "1.9.7",
5
+ "description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
6
+ "main": "lib/index.js",
7
+ "type": "commonjs",
8
+ "directories": {
9
+ "lib": "lib"
10
+ },
11
+ "scripts": {
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "author": {
15
+ "name": "Emin-G",
16
+ "email": "dev.mingowo@gmail.com"
17
+ },
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/Emin-G/buzzk.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/Emin-G/buzzk/issues"
25
+ },
26
+ "homepage": "https://github.com/Emin-G/buzzk",
27
+ "keywords": [
28
+ "chzzk",
29
+ "buzzk",
30
+ "치지직",
31
+ "뿌지직"
32
+ ],
33
+ "dependencies": {
34
+ "ws": "^8.16.0"
35
+ }
36
+ }