buzzk 1.9.5 → 1.9.6

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 +22 -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,12 @@ 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.connect();
119
+ }, 2000);
110
120
  });
111
121
 
112
122
  //WS Message
@@ -390,7 +400,7 @@ class chzzkChat {
390
400
  if (!this.#status.ws) return resolve(null);
391
401
 
392
402
  let reqOpt = {
393
- "ver": "2",
403
+ "ver": "3",
394
404
  "cmd": 5101,
395
405
  "svcid": this.#svcid,
396
406
  "cid": this.#chatID,
@@ -535,10 +545,17 @@ class chzzkChat {
535
545
  if (!this.#status.ping || pingID != this.#status.pingID) return;
536
546
 
537
547
  let pingOpt = {
538
- "ver": "2",
548
+ "ver": "3",
539
549
  "cmd": 0
540
550
  };
541
- if (this.#ws.readyState == WebSocket.OPEN) this.#ws.send(JSON.stringify(pingOpt));
551
+ try {
552
+ await this.#ws.send(JSON.stringify(pingOpt));
553
+ }
554
+ catch (error) {
555
+ return setTimeout(async () => {
556
+ return this.#ping(pingID);
557
+ }, 20000);
558
+ }
542
559
 
543
560
  setTimeout(() => {
544
561
  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.6",
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
+ }