@codebam/cf-workers-telegram-bot 3.44.0 → 3.45.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.
@@ -7,7 +7,7 @@ export default class Handler {
7
7
  this.configs = configs;
8
8
  }
9
9
  getResponse = async (_request, _bot) => {
10
- this.getAccessKeys(this.configs).then((access_keys) => Object.keys(access_keys).forEach((key) => log(`${access_keys[key].bot_name} ${new URL(_request?.url ?? localhost).origin}/${key}`)));
10
+ this.getAccessKeys(this.configs).then((access_keys) => Object.keys(access_keys).forEach((key) => log(`${access_keys[key].bot_name} ${new URL(_request?.url ?? localhost).href}${key}`)));
11
11
  if (_bot?.webhook.token) {
12
12
  return _bot.webhook.process(new URL(_request?.url ?? localhost));
13
13
  }
@@ -4,8 +4,8 @@ export default class TelegramWebhook extends Webhook {
4
4
  constructor(api, token, url) {
5
5
  super(api, token, url);
6
6
  }
7
- set = async (drop_pending_updates = true) => sha256(this.token).then((access_key) => fetch_json(addSearchParams(new URL(`${this.api.href}/setWebhook`), {
8
- url: new URL(`${this.url.href}/${access_key}`).href.replace(/([^:]\/)\/+/g, "$1"),
7
+ set = async (drop_pending_updates = true) => sha256(this.token).then((access_key) => fetch_json(addSearchParams(new URL(`${this.api.origin}/setWebhook`), {
8
+ url: new URL(`${this.url.href}${access_key}`).href,
9
9
  max_connections: "100",
10
10
  allowed_updates: JSON.stringify(["message", "inline_query"]),
11
11
  drop_pending_updates: drop_pending_updates.toString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebam/cf-workers-telegram-bot",
3
- "version": "3.44.0",
3
+ "version": "3.45.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",
@@ -39,5 +39,5 @@
39
39
  "prettier": "^2.8.4",
40
40
  "typescript": "^4.9.5"
41
41
  },
42
- "gitHead": "5b1100a1eeb644f35d0a72c27fcf8e99e353d814"
42
+ "gitHead": "be956bd06e29a9fea3daf4d85153533544188c0c"
43
43
  }