buzzk 2.1.1 → 2.1.3

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 +8 -13
  2. package/package.json +1 -1
package/lib/chat.js CHANGED
@@ -18,13 +18,12 @@ class chzzkChatData {
18
18
  }
19
19
 
20
20
  class chzzkDonationData {
21
- constructor(type, amount, id, name, hasMod, message, emojis) {
21
+ constructor(type, amount, id, name, message, emojis) {
22
22
  this.type = type;
23
23
  this.amount = amount;
24
24
  this.author = {
25
25
  id: id,
26
- name: name,
27
- hasMod: hasMod
26
+ name: name
28
27
  };
29
28
  this.message = message;
30
29
  this.emojis = emojis;
@@ -110,9 +109,11 @@ class chzzkChat {
110
109
  console.log(data);
111
110
 
112
111
  let hasMod = false;
113
- for (let o in data.profile.badges) {
114
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
115
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
112
+ if (data.profile || data.profile.badges) {
113
+ for (let o in data.profile.badges) {
114
+ if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
115
+ if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
116
+ }
116
117
  }
117
118
 
118
119
  let chatData = new chzzkChatData(data.senderChannelId, data.profile.nickname, hasMod, data.content, data.emojis, data.messageTime);
@@ -124,13 +125,7 @@ class chzzkChat {
124
125
  data = JSON.parse(data);
125
126
  console.log(data);
126
127
 
127
- let hasMod = false;
128
- for (let o in data.profile.badges) {
129
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
130
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
131
- }
132
-
133
- let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, hasMod, data.donationText, data.emojis);
128
+ let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, data.donationText, data.emojis);
134
129
  return this.#callbacks.donation(donationData);
135
130
  });
136
131
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzk",
3
3
  "displayName": "BUZZK",
4
- "version": "2.1.1",
4
+ "version": "2.1.3",
5
5
  "description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
6
6
  "main": "lib/index.js",
7
7
  "type": "commonjs",