buzzk 2.1.2 → 2.1.4

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 +5 -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;
@@ -106,6 +105,7 @@ class chzzkChat {
106
105
  });
107
106
 
108
107
  this.#ws.on("CHAT", (data) => {
108
+ if (!this.#callbacks.message) return;
109
109
  data = JSON.parse(data);
110
110
  console.log(data);
111
111
 
@@ -118,23 +118,15 @@ class chzzkChat {
118
118
  }
119
119
 
120
120
  let chatData = new chzzkChatData(data.senderChannelId, data.profile.nickname, hasMod, data.content, data.emojis, data.messageTime);
121
- if (!this.#callbacks.message) return;
122
121
  return this.#callbacks.message(chatData);
123
122
  });
124
123
 
125
124
  this.#ws.on("DONATION", (data) => {
125
+ if (!this.#callbacks.donation) return;
126
126
  data = JSON.parse(data);
127
127
  console.log(data);
128
128
 
129
- let hasMod = false;
130
- if (data.profile || data.profile.badges) {
131
- for (let o in data.profile.badges) {
132
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/streamer.png") hasMod = true;
133
- if (data.profile.badges[o].imageUrl == "https://ssl.pstatic.net/static/nng/glive/icon/manager.png") hasMod = true;
134
- }
135
- }
136
-
137
- let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, hasMod, data.donationText, data.emojis);
129
+ let donationData = new chzzkDonationData(data.donationType, data.payAmount, data.donatorChannelId, data.donatorNickname, data.donationText, data.emojis);
138
130
  return this.#callbacks.donation(donationData);
139
131
  });
140
132
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "buzzk",
3
3
  "displayName": "BUZZK",
4
- "version": "2.1.2",
4
+ "version": "2.1.4",
5
5
  "description": "뿌지직 (BUZZK) - 치지직(CHZZK) 챗봇을 더욱 쉽게 개발할 수 있도록 돕는 비공식 라이브러리.",
6
6
  "main": "lib/index.js",
7
7
  "type": "commonjs",