@codebam/cf-workers-telegram-bot 12.6.8 → 12.6.10

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.
@@ -135,6 +135,14 @@ export default class TelegramBot {
135
135
  }
136
136
  const fullCommand = args[commandIndex];
137
137
  const command = fullCommand.substring(1, fullCommand.lastIndexOf('@') > -1 ? fullCommand.lastIndexOf('@') : fullCommand.length);
138
+ if (ctx.update_type === 'business_message') {
139
+ const isOwner = ctx.update.business_message?.from?.id !== ctx.update.business_message?.chat?.id;
140
+ if (command === 'clear' && isOwner) {
141
+ ctx.args = args.slice(commandIndex);
142
+ return command;
143
+ }
144
+ return this.defaultCommand;
145
+ }
138
146
  if (command in this.commands) {
139
147
  // Shift args so the command handler sees the command at index 0
140
148
  ctx.args = args.slice(commandIndex);
package/dist/webhook.js CHANGED
@@ -34,7 +34,16 @@ export default class Webhook {
34
34
  const params = {
35
35
  url: this.webhook.toString(),
36
36
  max_connections: '40',
37
- allowed_updates: JSON.stringify(['message', 'inline_query', 'guest_message', 'business_message', 'business_connection']),
37
+ allowed_updates: JSON.stringify([
38
+ 'message',
39
+ 'edited_message',
40
+ 'callback_query',
41
+ 'inline_query',
42
+ 'guest_message',
43
+ 'business_message',
44
+ 'business_connection',
45
+ 'pre_checkout_query',
46
+ ]),
38
47
  drop_pending_updates: 'true',
39
48
  };
40
49
  if (this.secretToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebam/cf-workers-telegram-bot",
3
- "version": "12.6.8",
3
+ "version": "12.6.10",
4
4
  "description": "serverless telegram bot on cf workers",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",