buzzk 1.9.13 → 1.10.0

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/live.js +11 -2
  2. package/package.json +1 -1
package/lib/live.js CHANGED
@@ -1,4 +1,4 @@
1
- const { reqChzzk } = require("./tool.js");
1
+ const { reqChzzk, reqGame } = require("./tool.js");
2
2
 
3
3
  /**
4
4
  * @typedef {Object} chzzkLiveDetail
@@ -106,7 +106,16 @@ async function getStatus (channelID) {
106
106
  });
107
107
  }
108
108
 
109
+ async function getAccess (chatID) {
110
+ return new Promise(async (resolve, reject) => {
111
+ let accRes = await reqGame("nng_main/v1/chats/access-token?channelId=" + chatID + "&chatType=STREAMING");
112
+ if (accRes.code != 200) return resolve(null);
113
+ return resolve(accRes.content.accessToken);
114
+ });
115
+ }
116
+
109
117
  module.exports = {
110
118
  getDetail: getDetail,
111
- getStatus: getStatus
119
+ getStatus: getStatus,
120
+ getAccess: getAccess
112
121
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzk",
3
3
  "displayName": "BUZZK",
4
- "version": "1.9.13",
4
+ "version": "1.10.0",
5
5
  "description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
6
6
  "main": "lib/index.js",
7
7
  "type": "commonjs",