rubjs 3.2.3 → 3.2.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Bot from '../../bot';
|
|
2
2
|
import { UpdateEndpointTypeEnum } from '../../types/models';
|
|
3
|
-
declare function run(this: Bot, url?: string,
|
|
3
|
+
declare function run(this: Bot, url?: string, path?: string, port?: number, host?: string, updates?: UpdateEndpointTypeEnum[]): Promise<void>;
|
|
4
4
|
export default run;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../../types/models");
|
|
4
|
-
async function run(url,
|
|
4
|
+
async function run(url, path, port = 3000, host, updates = [
|
|
5
5
|
models_1.UpdateEndpointTypeEnum.ReceiveInlineMessage,
|
|
6
6
|
models_1.UpdateEndpointTypeEnum.ReceiveUpdate,
|
|
7
7
|
]) {
|
|
@@ -9,7 +9,7 @@ async function run(url, host, port = 3000, updates = [
|
|
|
9
9
|
await this.network.delay(2000);
|
|
10
10
|
}
|
|
11
11
|
if (url)
|
|
12
|
-
await this.__setupWebhook(url, host, port, updates);
|
|
12
|
+
await this.__setupWebhook(url, path, host, port, updates);
|
|
13
13
|
else
|
|
14
14
|
await this.__polling();
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Bot from '../../bot';
|
|
2
2
|
import { UpdateEndpointTypeEnum } from '../../types/models';
|
|
3
|
-
declare function setupWebhook(this: Bot, url: string, host?: string, port?: number, updates?: UpdateEndpointTypeEnum[]): Promise<void>;
|
|
3
|
+
declare function setupWebhook(this: Bot, url: string, path?: string, host?: string, port?: number, updates?: UpdateEndpointTypeEnum[]): Promise<void>;
|
|
4
4
|
export default setupWebhook;
|
|
@@ -18,12 +18,12 @@ function handleParser(_, body, done) {
|
|
|
18
18
|
function lowerFirstChar(str) {
|
|
19
19
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
20
20
|
}
|
|
21
|
-
async function setupWebhook(url, host = '0.0.0.0', port = 3000, updates = []) {
|
|
21
|
+
async function setupWebhook(url, path = "", host = '0.0.0.0', port = 3000, updates = []) {
|
|
22
22
|
this.server.addContentTypeParser('application/json', { parseAs: 'string' }, handleParser);
|
|
23
|
-
this.server.get(
|
|
24
|
-
this.server.post(
|
|
23
|
+
this.server.get(`${path}/`, handleUpdates_1.default.bind(this));
|
|
24
|
+
this.server.post(`${path}/`, handleUpdates_1.default.bind(this));
|
|
25
25
|
for (let update of updates) {
|
|
26
|
-
this.server.post(
|
|
26
|
+
this.server.post(`${path}/${lowerFirstChar(update)}`, handleUpdates_1.default.bind(this));
|
|
27
27
|
}
|
|
28
28
|
await this.server.listen({ port, host });
|
|
29
29
|
for (let update of updates) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rubjs",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"keywords": [
|
|
@@ -33,8 +33,6 @@
|
|
|
33
33
|
"axios": "^1.11.0",
|
|
34
34
|
"fastify": "^5.4.0",
|
|
35
35
|
"json-bigint": "^1.0.0",
|
|
36
|
-
"localtunnel": "npm:@security-patched/localtunnel@^2.0.2-secpatched.5",
|
|
37
|
-
"ngrok": "^5.0.0-beta.2",
|
|
38
36
|
"node-rsa": "^1.1.1",
|
|
39
37
|
"optional-require": "^2.0.1",
|
|
40
38
|
"undici": "^7.10.0",
|
|
@@ -42,7 +40,6 @@
|
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
42
|
"@types/json-bigint": "^1.0.4",
|
|
45
|
-
"@types/localtunnel": "^2.0.4",
|
|
46
43
|
"@types/node": "^22.13.1",
|
|
47
44
|
"@types/node-rsa": "^1.1.4",
|
|
48
45
|
"@types/user-agents": "^1.0.4",
|