@codebam/cf-workers-telegram-bot 5.7.0 → 5.8.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.
package/dist/main/src/bot_api.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import Handler from "./handler";
|
|
2
|
-
import { Webhook, localhost } from "./types";
|
|
3
1
|
export default class BotApi {
|
|
4
2
|
commands;
|
|
5
3
|
webhook;
|
|
6
4
|
handler;
|
|
7
5
|
update;
|
|
8
6
|
constructor(config) {
|
|
9
|
-
this.commands = config.commands
|
|
10
|
-
this.webhook =
|
|
11
|
-
|
|
12
|
-
this.handler = config.handler || new Handler([]);
|
|
7
|
+
this.commands = config.commands;
|
|
8
|
+
this.webhook = config.webhook;
|
|
9
|
+
this.handler = config.handler;
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -123,20 +123,20 @@ export default class TelegramBot extends TelegramApi {
|
|
|
123
123
|
_average = (numbers) => parseFloat((numbers.reduce((prev, cur) => prev + cur, 0) / numbers.length || 0).toFixed(2));
|
|
124
124
|
// bot command: /recursion
|
|
125
125
|
recursion = async (update) => this.sendMessage(update.message?.chat.id ?? 0, "/recursion");
|
|
126
|
-
// .then((response) =>
|
|
127
|
-
// .then((result
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
126
|
+
// .then((response) => response.json())
|
|
127
|
+
// .then((result) =>
|
|
128
|
+
// this.handler.postResponse(
|
|
129
|
+
// new Request("", {
|
|
130
|
+
// method: "POST",
|
|
131
|
+
// body: JSON.stringify({
|
|
132
|
+
// message: {
|
|
133
|
+
// text: (result as { result: { text: string } }).result.text,
|
|
134
|
+
// chat: { id: update.message?.chat.id },
|
|
135
|
+
// },
|
|
136
|
+
// }),
|
|
137
|
+
// }),
|
|
138
|
+
// this
|
|
139
|
+
// )
|
|
140
140
|
// );
|
|
141
141
|
// bot command: /roll
|
|
142
142
|
roll = async (update, args) => ((outcome, message) => update.inline_query
|
|
@@ -14,7 +14,6 @@ export default class TelegramWebhook extends Webhook {
|
|
|
14
14
|
get = async () => fetch_json(new URL(`${this.api.origin}${this.api.pathname}/getWebhookInfo`));
|
|
15
15
|
delete = async () => fetch_json(new URL(`${this.api.origin}${this.api.pathname}/deleteWebhook`));
|
|
16
16
|
commands = {
|
|
17
|
-
...this.commands,
|
|
18
17
|
set: this.set,
|
|
19
18
|
get: this.get,
|
|
20
19
|
delete: this.delete,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codebam/cf-workers-telegram-bot",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "serverless telegram bot on cf workers",
|
|
5
5
|
"main": "./dist/main/src/main.js",
|
|
6
6
|
"module": "./dist/main/src/main.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"url": "https://github.com/codebam/cf-workers-telegram-bot.git"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudflare/workers-types": "^4.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
34
|
-
"@typescript-eslint/parser": "^6.
|
|
35
|
-
"eslint": "^8.
|
|
32
|
+
"@cloudflare/workers-types": "^4.20230914.0",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
34
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
35
|
+
"eslint": "^8.49.0",
|
|
36
36
|
"eslint-config-prettier": "^9.0.0",
|
|
37
37
|
"lerna": "^7.1.5",
|
|
38
|
-
"prettier": "^3.0.
|
|
39
|
-
"typescript": "^5.
|
|
38
|
+
"prettier": "^3.0.2",
|
|
39
|
+
"typescript": "^5.2.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "4101ac66eb6a0f94d2fb939863286b334f79cbbc"
|
|
42
42
|
}
|