@codebam/cf-workers-telegram-bot 11.10.0 → 11.12.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/telegram_api.d.ts
CHANGED
|
@@ -203,6 +203,7 @@ export default class TelegramApi {
|
|
|
203
203
|
parse_mode?: string;
|
|
204
204
|
disable_web_page_preview?: boolean;
|
|
205
205
|
reply_markup?: object;
|
|
206
|
+
business_connection_id?: string | number;
|
|
206
207
|
}): Promise<Response>;
|
|
207
208
|
sendMessageDraft(botApi: string, data: SendMessageDraftParams): Promise<Response>;
|
|
208
209
|
/**
|
package/dist/telegram_bot.js
CHANGED
|
@@ -116,6 +116,8 @@ export default class TelegramBot {
|
|
|
116
116
|
case 'guest_message':
|
|
117
117
|
// For guest messages, we fall through to command detection if it's not a special type
|
|
118
118
|
break;
|
|
119
|
+
case 'business_message':
|
|
120
|
+
return this.defaultCommand;
|
|
119
121
|
case 'pre_checkout_query':
|
|
120
122
|
return ':pre_checkout_query' in this.commands ? ':pre_checkout_query' : this.defaultCommand;
|
|
121
123
|
case 'successful_payment':
|
|
@@ -132,6 +134,9 @@ export default class TelegramBot {
|
|
|
132
134
|
return command;
|
|
133
135
|
}
|
|
134
136
|
}
|
|
137
|
+
if (ctx.update_type === 'guest_message' && ':guest_message' in this.commands) {
|
|
138
|
+
return ':guest_message';
|
|
139
|
+
}
|
|
135
140
|
return this.defaultCommand;
|
|
136
141
|
}
|
|
137
142
|
/**
|
|
@@ -156,6 +156,14 @@ export default class TelegramExecutionContext {
|
|
|
156
156
|
reply_to_message_id: this.getMessageId(),
|
|
157
157
|
video,
|
|
158
158
|
});
|
|
159
|
+
case 'business_message':
|
|
160
|
+
return await this.api.sendVideo(this.bot.api.toString(), {
|
|
161
|
+
...options,
|
|
162
|
+
chat_id: this.getChatId(),
|
|
163
|
+
message_thread_id: this.getThreadId(),
|
|
164
|
+
business_connection_id: this.update.business_message?.business_connection_id.toString() ?? '',
|
|
165
|
+
video,
|
|
166
|
+
});
|
|
159
167
|
case 'guest_message':
|
|
160
168
|
return await this.answerGuestQueryVideo(video);
|
|
161
169
|
case 'inline':
|
|
@@ -196,6 +204,15 @@ export default class TelegramExecutionContext {
|
|
|
196
204
|
photo,
|
|
197
205
|
caption,
|
|
198
206
|
});
|
|
207
|
+
case 'business_message':
|
|
208
|
+
return await this.api.sendPhoto(this.bot.api.toString(), {
|
|
209
|
+
...options,
|
|
210
|
+
chat_id: this.getChatId(),
|
|
211
|
+
message_thread_id: this.getThreadId(),
|
|
212
|
+
business_connection_id: this.update.business_message?.business_connection_id.toString() ?? '',
|
|
213
|
+
photo,
|
|
214
|
+
caption,
|
|
215
|
+
});
|
|
199
216
|
case 'guest_message':
|
|
200
217
|
return await this.answerGuestQueryPhoto(photo, caption);
|
|
201
218
|
case 'inline':
|
|
@@ -226,6 +243,15 @@ export default class TelegramExecutionContext {
|
|
|
226
243
|
voice,
|
|
227
244
|
caption,
|
|
228
245
|
});
|
|
246
|
+
case 'business_message':
|
|
247
|
+
return await this.api.sendVoice(this.bot.api.toString(), {
|
|
248
|
+
...options,
|
|
249
|
+
chat_id: this.getChatId(),
|
|
250
|
+
message_thread_id: this.getThreadId(),
|
|
251
|
+
business_connection_id: this.update.business_message?.business_connection_id.toString() ?? '',
|
|
252
|
+
voice,
|
|
253
|
+
caption,
|
|
254
|
+
});
|
|
229
255
|
case 'guest_message':
|
|
230
256
|
return await this.answerGuestQueryVoice(voice, caption);
|
|
231
257
|
default:
|
|
@@ -336,12 +362,14 @@ export default class TelegramExecutionContext {
|
|
|
336
362
|
*/
|
|
337
363
|
async streamReply(message, draft_id, parse_mode = '', options = {}) {
|
|
338
364
|
const message_id = this.drafts.get(draft_id);
|
|
365
|
+
const business_connection_id = this.update.business_message?.business_connection_id.toString();
|
|
339
366
|
if (message_id) {
|
|
340
367
|
return await this.api.editMessageText(this.bot.api.toString(), {
|
|
341
368
|
chat_id: this.getChatId(),
|
|
342
369
|
message_id,
|
|
343
370
|
text: message,
|
|
344
371
|
parse_mode,
|
|
372
|
+
business_connection_id,
|
|
345
373
|
...options,
|
|
346
374
|
});
|
|
347
375
|
}
|
|
@@ -358,6 +386,7 @@ export default class TelegramExecutionContext {
|
|
|
358
386
|
message_thread_id: this.getThreadId(),
|
|
359
387
|
text: message,
|
|
360
388
|
parse_mode,
|
|
389
|
+
business_connection_id,
|
|
361
390
|
});
|
|
362
391
|
if (response.status === 200) {
|
|
363
392
|
const cloned = response.clone();
|
|
@@ -442,6 +471,7 @@ export default class TelegramExecutionContext {
|
|
|
442
471
|
return await this.api.sendInvoice(this.bot.api.toString(), {
|
|
443
472
|
chat_id: this.getChatId(),
|
|
444
473
|
message_thread_id: this.getThreadId(),
|
|
474
|
+
business_connection_id: this.update.business_message?.business_connection_id.toString(),
|
|
445
475
|
title,
|
|
446
476
|
description,
|
|
447
477
|
payload,
|