@codebam/cf-workers-telegram-bot 12.6.7 → 12.6.9
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/telegram_bot.js +10 -1
- package/package.json +1 -1
package/dist/telegram_bot.js
CHANGED
|
@@ -120,7 +120,8 @@ export default class TelegramBot {
|
|
|
120
120
|
// For guest messages, we fall through to command detection if it's not a special type
|
|
121
121
|
break;
|
|
122
122
|
case 'business_message':
|
|
123
|
-
|
|
123
|
+
// For business messages, we fall through to command detection if it's not a special type
|
|
124
|
+
break;
|
|
124
125
|
case 'pre_checkout_query':
|
|
125
126
|
return ':pre_checkout_query' in this.commands ? ':pre_checkout_query' : this.defaultCommand;
|
|
126
127
|
case 'successful_payment':
|
|
@@ -134,6 +135,14 @@ export default class TelegramBot {
|
|
|
134
135
|
}
|
|
135
136
|
const fullCommand = args[commandIndex];
|
|
136
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
|
+
}
|
|
137
146
|
if (command in this.commands) {
|
|
138
147
|
// Shift args so the command handler sees the command at index 0
|
|
139
148
|
ctx.args = args.slice(commandIndex);
|