buzzk 2.3.8 → 2.3.10
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/LICENSE +20 -20
- package/README.md +17 -2
- package/lib/chat.js +17 -2
- package/lib/tool.js +24 -8
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Emin-G
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Emin-G
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -32,6 +32,21 @@
|
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
+
## ✒️ 마이그레이션 가이드 (v.2.3.x -> v.2.3.8)
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary>펼쳐보기</summary>
|
|
39
|
+
|
|
40
|
+
buzzk.oauth
|
|
41
|
+
|
|
42
|
+
| <img src="https://github.com/Emin-G/Img/blob/main/tags/tag_change-min.png?raw=true" alt="BUZZK" width="70"> | buzzk.oauth.get("Code 값") |
|
|
43
|
+
|--|--|
|
|
44
|
+
| | buzzk.oauth.get("Code 값", "State 값") |
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
35
50
|
## ✒️ 마이그레이션 가이드 (v.2.0.x -> v.2.1.0)
|
|
36
51
|
|
|
37
52
|
<details>
|
|
@@ -148,7 +163,7 @@
|
|
|
148
163
|
|
|
149
164
|
async function test () {
|
|
150
165
|
|
|
151
|
-
let oauth = buzzk.oauth.get("code 값");
|
|
166
|
+
let oauth = buzzk.oauth.get("code 값", "state 값");
|
|
152
167
|
|
|
153
168
|
let chat = new buzzkChat(oauth.access);
|
|
154
169
|
await chat.connect(); //채팅창 연결
|
|
@@ -212,7 +227,7 @@ dotenv와 함께 사용하는 것을 매우 권장합니다.
|
|
|
212
227
|
|
|
213
228
|
✅ Official API
|
|
214
229
|
|
|
215
|
-
let oauth = await buzzk.oauth.get("Code 값");
|
|
230
|
+
let oauth = await buzzk.oauth.get("Code 값", "State 값");
|
|
216
231
|
console.log(oauth);
|
|
217
232
|
|
|
218
233
|
<details>
|
package/lib/chat.js
CHANGED
|
@@ -248,9 +248,24 @@ class chzzkChat {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
let chatRes = await USER.post(this.accessToken, "open/v1/chats/send", JSON.stringify(reqMessage));
|
|
251
|
-
if (!chatRes || chatRes.code != 200) return resolve(false);
|
|
252
251
|
|
|
253
|
-
|
|
252
|
+
//rate-limit
|
|
253
|
+
if (chatRes && chatRes.code == 429) {
|
|
254
|
+
let chatRetry = Math.floor(Math.random() * 500) + 500;
|
|
255
|
+
|
|
256
|
+
setTimeout(async () => {
|
|
257
|
+
let retRes = await USER.post(this.accessToken, "open/v1/chats/send", JSON.stringify(reqMessage));
|
|
258
|
+
|
|
259
|
+
if (!retRes || retRes.code != 200) return resolve(false);
|
|
260
|
+
return resolve(true);
|
|
261
|
+
}, chatRetry);
|
|
262
|
+
}
|
|
263
|
+
//rate-limit
|
|
264
|
+
|
|
265
|
+
else {
|
|
266
|
+
if (!chatRes || chatRes.code != 200) return resolve(false);
|
|
267
|
+
return resolve(true);
|
|
268
|
+
}
|
|
254
269
|
});
|
|
255
270
|
}
|
|
256
271
|
|
package/lib/tool.js
CHANGED
|
@@ -23,7 +23,9 @@ function clientGet (path) {
|
|
|
23
23
|
|
|
24
24
|
.catch((error) => {
|
|
25
25
|
console.log(error);
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
28
|
+
else return resolve({"code": 500});
|
|
27
29
|
});
|
|
28
30
|
|
|
29
31
|
});
|
|
@@ -50,7 +52,9 @@ function clientPost (path, body) {
|
|
|
50
52
|
|
|
51
53
|
.catch((error) => {
|
|
52
54
|
console.log(error);
|
|
53
|
-
|
|
55
|
+
|
|
56
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
57
|
+
else return resolve({"code": 500});
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
});
|
|
@@ -75,7 +79,9 @@ function userGet (token, path) {
|
|
|
75
79
|
|
|
76
80
|
.catch((error) => {
|
|
77
81
|
console.log(error);
|
|
78
|
-
|
|
82
|
+
|
|
83
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
84
|
+
else return resolve({"code": 500});
|
|
79
85
|
});
|
|
80
86
|
|
|
81
87
|
});
|
|
@@ -101,7 +107,9 @@ function userPost (token, path, body) {
|
|
|
101
107
|
|
|
102
108
|
.catch((error) => {
|
|
103
109
|
console.log(error);
|
|
104
|
-
|
|
110
|
+
|
|
111
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
112
|
+
else return resolve({"code": 500});
|
|
105
113
|
});
|
|
106
114
|
|
|
107
115
|
});
|
|
@@ -125,7 +133,9 @@ function reqChzzk (path) {
|
|
|
125
133
|
|
|
126
134
|
.catch((error) => {
|
|
127
135
|
console.log(error);
|
|
128
|
-
|
|
136
|
+
|
|
137
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
138
|
+
else return resolve({"code": 500});
|
|
129
139
|
});
|
|
130
140
|
|
|
131
141
|
});
|
|
@@ -149,7 +159,9 @@ function exChzzk (method, path) {
|
|
|
149
159
|
|
|
150
160
|
.catch((error) => {
|
|
151
161
|
console.log(error);
|
|
152
|
-
|
|
162
|
+
|
|
163
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
164
|
+
else return resolve({"code": 500});
|
|
153
165
|
});
|
|
154
166
|
|
|
155
167
|
});
|
|
@@ -172,7 +184,9 @@ function reqGame (path) {
|
|
|
172
184
|
|
|
173
185
|
.catch((error) => {
|
|
174
186
|
console.log(error);
|
|
175
|
-
|
|
187
|
+
|
|
188
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
189
|
+
else return resolve({"code": 500});
|
|
176
190
|
});
|
|
177
191
|
|
|
178
192
|
});
|
|
@@ -195,7 +209,9 @@ function reqNaver (path) {
|
|
|
195
209
|
|
|
196
210
|
.catch((error) => {
|
|
197
211
|
console.log(error);
|
|
198
|
-
|
|
212
|
+
|
|
213
|
+
if (error && error.status) return resolve({"code": error.status});
|
|
214
|
+
else return resolve({"code": 500});
|
|
199
215
|
});
|
|
200
216
|
|
|
201
217
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buzzk",
|
|
3
3
|
"displayName": "BUZZK",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.10",
|
|
5
5
|
"description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"type": "commonjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"뿌지직"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"axios": "^1.
|
|
34
|
+
"axios": "^1.15.0",
|
|
35
35
|
"socket.io-client": "^2.0.3"
|
|
36
36
|
}
|
|
37
37
|
}
|