hackchat-engine 1.1.4 → 1.1.6

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/.eslintrc.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es6": true,
5
- "node": true
6
- },
7
- "extends": [
8
- "airbnb-base"
9
- ],
10
- "globals": {
11
- "Atomics": "readonly",
12
- "SharedArrayBuffer": "readonly"
13
- },
14
- "parserOptions": {
15
- "ecmaVersion": 2018,
16
- "sourceType": "module"
17
- },
18
- "rules": {
19
- "import/extensions": [
20
- "error",
21
- "ignorePackages",
22
- {
23
- "js": "always"
24
- }
25
- ]
26
- }
27
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "airbnb-base"
9
+ ],
10
+ "globals": {
11
+ "Atomics": "readonly",
12
+ "SharedArrayBuffer": "readonly"
13
+ },
14
+ "parserOptions": {
15
+ "ecmaVersion": 2018,
16
+ "sourceType": "module"
17
+ },
18
+ "rules": {
19
+ "import/extensions": [
20
+ "error",
21
+ "ignorePackages",
22
+ {
23
+ "js": "always"
24
+ }
25
+ ]
26
+ }
27
+ }
package/Client.js CHANGED
@@ -137,7 +137,7 @@ class Client extends EventEmitter {
137
137
  * Sends a join event to the hackchat server
138
138
  * @param {string} name Name to join with
139
139
  * @param {string} password Optional password to create trip code
140
- * @param {string} channel Cchannel to auto join
140
+ * @param {string} channel Channel to auto join
141
141
  * @returns {void}
142
142
  */
143
143
  join(name = false, password = '', channel = false) {
@@ -266,6 +266,17 @@ class Client extends EventEmitter {
266
266
  this.intervals.delete(interval);
267
267
  }
268
268
 
269
+ /**
270
+ * Send `changecolor` operation to the server
271
+ * @param {string} newColor HTML color code
272
+ */
273
+ changeColor(newColor) {
274
+ this.ws.send({
275
+ cmd: OPCodes.CHANGE_COLOR,
276
+ color: newColor,
277
+ });
278
+ }
279
+
269
280
  /**
270
281
  * Send `chat` operation to the server
271
282
  * @param {string} channel Target channel to send `text`
package/package.json CHANGED
@@ -1,63 +1,63 @@
1
- {
2
- "_from": "hackchat-engine@^1.0.9",
3
- "_inBundle": false,
4
- "_integrity": "sha512-uxyU4HBAs8L4hQktdtvTP/3drbJHQvjkeQDdonglAffHIPtZ1pgU9W/ScNXNCFEyqDAo/QSVikfXp0wMmLtzeQ==",
5
- "_location": "/hackchat-engine",
6
- "_phantomChildren": {},
7
- "_requested": {
8
- "type": "range",
9
- "registry": true,
10
- "raw": "hackchat-engine@^1.0.9",
11
- "name": "hackchat-engine",
12
- "escapedName": "hackchat-engine",
13
- "rawSpec": "^1.0.9",
14
- "saveSpec": null,
15
- "fetchSpec": "^1.0.9"
16
- },
17
- "_requiredBy": [
18
- "#USER",
19
- "/"
20
- ],
21
- "_resolved": "https://registry.npmjs.org/hackchat-engine/-/hackchat-engine-1.0.9.tgz",
22
- "_shasum": "536ea142dbfca44d3853c5767b7797c303642cdb",
23
- "_spec": "hackchat-engine@^1.0.9",
24
- "_where": "C:\\Users\\Owner\\Documents\\GitHub\\hcClientBeta",
25
- "author": {
26
- "name": "Marzavec"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/hack-chat/hackchat-engine/issues"
30
- },
31
- "bundleDependencies": false,
32
- "dependencies": {
33
- "node-fetch": "^2.6.0",
34
- "ws": "^7.2.0"
35
- },
36
- "deprecated": false,
37
- "description": "hack.chat chat engine",
38
- "devDependencies": {
39
- "eslint": "^7.12.1",
40
- "eslint-config-airbnb-base": "^14.2.0",
41
- "eslint-plugin-import": "^2.22.1"
42
- },
43
- "homepage": "https://github.com/hack-chat/hackchat-engine#readme",
44
- "keywords": [
45
- "hack.chat",
46
- "chat",
47
- "client"
48
- ],
49
- "type": "module",
50
- "license": "WTFPL",
51
- "main": "index.js",
52
- "name": "hackchat-engine",
53
- "repository": {
54
- "type": "git",
55
- "url": "git+https://github.com/hack-chat/hackchat-engine.git"
56
- },
57
- "scripts": {
58
- "lint": "eslint --ignore-path .gitignore .",
59
- "lintfix": "eslint --fix --ignore-path .gitignore .",
60
- "test": "echo \"Error: no test specified\" && exit 1"
61
- },
62
- "version": "1.1.4"
63
- }
1
+ {
2
+ "_from": "hackchat-engine@^1.0.9",
3
+ "_inBundle": false,
4
+ "_integrity": "sha512-uxyU4HBAs8L4hQktdtvTP/3drbJHQvjkeQDdonglAffHIPtZ1pgU9W/ScNXNCFEyqDAo/QSVikfXp0wMmLtzeQ==",
5
+ "_location": "/hackchat-engine",
6
+ "_phantomChildren": {},
7
+ "_requested": {
8
+ "type": "range",
9
+ "registry": true,
10
+ "raw": "hackchat-engine@^1.0.9",
11
+ "name": "hackchat-engine",
12
+ "escapedName": "hackchat-engine",
13
+ "rawSpec": "^1.0.9",
14
+ "saveSpec": null,
15
+ "fetchSpec": "^1.0.9"
16
+ },
17
+ "_requiredBy": [
18
+ "#USER",
19
+ "/"
20
+ ],
21
+ "_resolved": "https://registry.npmjs.org/hackchat-engine/-/hackchat-engine-1.0.9.tgz",
22
+ "_shasum": "536ea142dbfca44d3853c5767b7797c303642cdb",
23
+ "_spec": "hackchat-engine@^1.0.9",
24
+ "_where": "C:\\Users\\Owner\\Documents\\GitHub\\hcClientBeta",
25
+ "author": {
26
+ "name": "Marzavec"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/hack-chat/hackchat-engine/issues"
30
+ },
31
+ "bundleDependencies": [],
32
+ "dependencies": {
33
+ "node-fetch": "^2.6.0",
34
+ "ws": "^7.2.0"
35
+ },
36
+ "deprecated": false,
37
+ "description": "hack.chat chat engine",
38
+ "devDependencies": {
39
+ "eslint": "^7.12.1",
40
+ "eslint-config-airbnb-base": "^14.2.0",
41
+ "eslint-plugin-import": "^2.22.1"
42
+ },
43
+ "homepage": "https://github.com/hack-chat/hackchat-engine#readme",
44
+ "keywords": [
45
+ "hack.chat",
46
+ "chat",
47
+ "client"
48
+ ],
49
+ "type": "module",
50
+ "license": "WTFPL",
51
+ "main": "index.js",
52
+ "name": "hackchat-engine",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/hack-chat/hackchat-engine.git"
56
+ },
57
+ "scripts": {
58
+ "lint": "eslint --ignore-path .gitignore .",
59
+ "lintfix": "eslint --fix --ignore-path .gitignore .",
60
+ "test": "echo \"Error: no test specified\" && exit 1"
61
+ },
62
+ "version": "1.1.6"
63
+ }
@@ -52,7 +52,7 @@ class SessionStruct {
52
52
 
53
53
  // add non-standard properties
54
54
  const dataKeys = Object.keys(data);
55
- for (let i = 0, j = dataKeys.length; i < j; i++) {
55
+ for (let i = 0, j = dataKeys.length; i < j; i += 1) {
56
56
  if (dataKeys[i] !== 'cmd' && dataKeys[i] !== 'time') {
57
57
  this[dataKeys[i]] = data[dataKeys[i]];
58
58
  }
package/util/Constants.js CHANGED
@@ -63,6 +63,7 @@ export const OPCodes = {
63
63
  CHAT: 'chat',
64
64
  INVITE: 'invite',
65
65
  CHANGE_NICK: 'changenick',
66
+ CHANGE_COLOR: 'changecolor',
66
67
  KICK: 'kick',
67
68
  BAN: 'ban',
68
69
  MUTE: 'muzzle',
@@ -66,7 +66,7 @@ class SocketController extends EventEmitter {
66
66
  */
67
67
  connect(gateway) {
68
68
  if (!this.connection) {
69
- this.connection = new SocketHandler(this, gateway, this.client.session);
69
+ this.connection = new SocketHandler(this, gateway, this.client.options.session);
70
70
  return true;
71
71
  }
72
72