File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @codebam/cf-workers-telegram-bot" ,
3- "version" : " 11.7.2 " ,
3+ "version" : " 11.8.0 " ,
44 "description" : " serverless telegram bot on cf workers" ,
55 "main" : " ./dist/main.js" ,
66 "module" : " ./dist/main.js" ,
Original file line number Diff line number Diff line change 1+ import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js' ;
12import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js' ;
23import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js' ;
34import TelegramInlineQueryResultVideo from './types/TelegramInlineQueryResultVideo.js' ;
@@ -64,7 +65,7 @@ export interface AnswerCallbackParams {
6465/** Interface for inline query parameters */
6566export interface AnswerInlineParams {
6667 inline_query_id : number | string ;
67- results : TelegramInlineQueryResultArticle [ ] | TelegramInlineQueryResultPhoto [ ] | TelegramInlineQueryResultVideo [ ] ;
68+ results : TelegramInlineQueryResult [ ] ;
6869 cache_time ?: number ;
6970 is_personal ?: boolean ;
7071 next_offset ?: string ;
@@ -73,7 +74,7 @@ export interface AnswerInlineParams {
7374/** Interface for guest query parameters */
7475export interface AnswerGuestParams {
7576 guest_query_id : string ;
76- result : TelegramInlineQueryResultArticle | TelegramInlineQueryResultPhoto | TelegramInlineQueryResultVideo ;
77+ result : TelegramInlineQueryResult ;
7778}
7879
7980/** Interface for invoice parameters */
Original file line number Diff line number Diff line change @@ -369,6 +369,10 @@ export default class TelegramExecutionContext {
369369 }
370370
371371 if ( this . update_type === 'guest_message' ) {
372+ if ( this . drafts . has ( draft_id ) ) {
373+ return new Response ( 'Query already answered' , { status : 200 } ) ;
374+ }
375+ this . drafts . set ( draft_id , - 1 ) ;
372376 return await this . answerGuestQueryText ( message , parse_mode ) ;
373377 }
374378
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ export default class TelegramInlineQueryResultPhoto extends TelegramInlineQueryR
1313 caption_entities ?: string ;
1414 // reply_markup?: TelegramInlineKeyboardMarkup;
1515 input_message_content ?: TelegramInputMessageContent ;
16- constructor ( photo : string ) {
16+ constructor ( data : { photo : string ; caption ?: string ; parse_mode ?: string ; title ?: string ; description ?: string } ) {
1717 super ( 'photo' ) ;
18- this . photo_url = photo ;
19- this . thumb_url = photo ;
18+ this . photo_url = data . photo ;
19+ this . thumb_url = data . photo ;
20+ this . caption = data . caption ;
21+ this . parse_mode = data . parse_mode ;
22+ this . title = data . title ;
23+ this . description = data . description ;
2024 }
2125}
Original file line number Diff line number Diff line change @@ -3,19 +3,23 @@ import TelegramInputMessageContent from './TelegramInputMessageContent.js';
33
44export default class TelegramInlineQueryResultVideo extends TelegramInlineQueryResult {
55 video_url : string ;
6+ mime_type : string ;
67 thumb_url : string ;
7- photo_width ?: number ;
8- photo_height ?: number ;
9- title ?: string ;
10- description ?: string ;
8+ title : string ;
119 caption ?: string ;
1210 parse_mode ?: string ;
13- caption_entities ?: string ;
14- // reply_markup?: TelegramInlineKeyboardMarkup;
11+ video_width ?: number ;
12+ video_height ?: number ;
13+ video_duration ?: number ;
14+ description ?: string ;
1515 input_message_content ?: TelegramInputMessageContent ;
16- constructor ( video : string ) {
16+ constructor ( data : { video : string ; title ?: string ; caption ?: string ; parse_mode ?: string } ) {
1717 super ( 'video' ) ;
18- this . video_url = video ;
19- this . thumb_url = video ;
18+ this . video_url = data . video ;
19+ this . mime_type = 'video/mp4' ;
20+ this . thumb_url = data . video ;
21+ this . title = data . title ?? 'Video' ;
22+ this . caption = data . caption ;
23+ this . parse_mode = data . parse_mode ;
2024 }
2125}
You can’t perform that action at this time.
0 commit comments