@hieuxyz/rpc 1.0.91 → 1.1.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.
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.DiscordWebSocket = void 0;
|
|
7
40
|
const ws_1 = __importDefault(require("ws"));
|
|
41
|
+
const zlib = __importStar(require("zlib"));
|
|
8
42
|
const logger_1 = require("../utils/logger");
|
|
9
43
|
const identify_1 = require("./entities/identify");
|
|
10
44
|
const OpCode_1 = require("./entities/OpCode");
|
|
@@ -98,8 +132,15 @@ class DiscordWebSocket {
|
|
|
98
132
|
logger_1.logger.error(`WebSocket Error: ${err.message}`);
|
|
99
133
|
});
|
|
100
134
|
}
|
|
101
|
-
onMessage(data) {
|
|
102
|
-
|
|
135
|
+
onMessage(data, isBinary) {
|
|
136
|
+
let decompressedData;
|
|
137
|
+
if (isBinary) {
|
|
138
|
+
decompressedData = zlib.inflateSync(data).toString('utf-8');
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
decompressedData = data.toString('utf-8');
|
|
142
|
+
}
|
|
143
|
+
const payload = JSON.parse(decompressedData);
|
|
103
144
|
if (payload.s) {
|
|
104
145
|
this.sequence = payload.s;
|
|
105
146
|
}
|
|
@@ -5,11 +5,12 @@ function getIdentifyPayload(token) {
|
|
|
5
5
|
return {
|
|
6
6
|
token: token,
|
|
7
7
|
capabilities: 65,
|
|
8
|
+
largeThreshold: 50,
|
|
8
9
|
properties: {
|
|
9
10
|
os: 'Windows',
|
|
10
11
|
browser: 'Discord Client',
|
|
11
12
|
device: 'hieuxyz©rpc',
|
|
12
13
|
},
|
|
13
|
-
compress:
|
|
14
|
+
compress: true,
|
|
14
15
|
};
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hieuxyz/rpc",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A Discord Rich Presence library for Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"ws": "^8.18.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "^24.6.
|
|
31
|
+
"@types/node": "^24.6.2",
|
|
32
32
|
"@types/ws": "^8.18.1",
|
|
33
33
|
"eslint": "^9.36.0",
|
|
34
34
|
"eslint-config-prettier": "^10.1.8",
|
|
35
35
|
"eslint-plugin-prettier": "^5.5.4",
|
|
36
36
|
"prettier": "^3.6.2",
|
|
37
37
|
"ts-node": "^10.9.2",
|
|
38
|
-
"typescript": "^5.9.
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
39
|
"typescript-eslint": "^8.45.0"
|
|
40
40
|
}
|
|
41
41
|
}
|