hackchat-engine 1.1.24 → 1.1.25
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/Client.js +10 -3
- package/package.json +1 -1
package/Client.js
CHANGED
|
@@ -138,9 +138,10 @@ class Client extends EventEmitter {
|
|
|
138
138
|
* @param {string} name Name to join with
|
|
139
139
|
* @param {string} password Optional password to create trip code
|
|
140
140
|
* @param {string} channel Channel to join
|
|
141
|
+
* @param {string|boolean} color Optional hex color for initial join
|
|
141
142
|
* @returns {void}
|
|
142
143
|
*/
|
|
143
|
-
join(name = false, password = '', channel = false) {
|
|
144
|
+
join(name = false, password = '', channel = false, color = false) {
|
|
144
145
|
try {
|
|
145
146
|
if (!name || typeof name !== 'string') {
|
|
146
147
|
throw new Error(Errors.INVALID_NAME);
|
|
@@ -150,12 +151,18 @@ class Client extends EventEmitter {
|
|
|
150
151
|
throw new Error(Errors.INVALID_CHANNEL);
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
const payload = {
|
|
154
155
|
cmd: OPCodes.JOIN,
|
|
155
156
|
nick: name,
|
|
156
157
|
pass: password,
|
|
157
158
|
channel,
|
|
158
|
-
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
if (color) {
|
|
162
|
+
payload.color = color;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.ws.send(payload);
|
|
159
166
|
} catch (e) {
|
|
160
167
|
this.destroy();
|
|
161
168
|
this.emit(Events.ERROR, `[client] Error joining channel: ${e}`);
|
package/package.json
CHANGED