@@ -52,7 +52,6 @@ export class CopBot {
5252 const app = express ( ) ;
5353 app . use ( express . json ( ) ) ;
5454 app . post ( webhookPath , async ( req , res ) => {
55- res . sendStatus ( 200 ) ;
5655 setImmediate ( async ( ) => {
5756 try {
5857 await webhookCallback ( this . _bot , 'express' ) ( req , res ) ;
@@ -74,7 +73,7 @@ export class CopBot {
7473 try {
7574 if ( ! webhookInfo . url ) {
7675 logger . warn ( 'Webhook is not set. Trying to set the webhook...' ) ;
77- await this . _bot . api . setWebhook ( webhookURL ) ;
76+ await this . _bot . api . setWebhook ( webhookURL , { max_connections : 100 } ) ;
7877 webhookInfo = await this . _bot . api . getWebhookInfo ( ) ;
7978 logger . info ( `Webhook set: ${ webhookInfo . url } ` ) ;
8079 } else {
@@ -114,7 +113,10 @@ export class CopBot {
114113 new GenerateCommand ( this . _bot ) . generate ( ) ;
115114 this . _bot . on ( 'my_chat_member' , ( ctx ) => this . handleJoinNewChat ( ctx ) ) ;
116115 this . _bot . on ( 'message' , ( ctx ) => this . handleMessage ( ctx ) ) ;
117- this . _bot . catch ( ( error : BotError < Context > ) => {
116+ this . _bot . catch ( async ( error : BotError < Context > ) => {
117+ if ( error . message . includes ( 'timeout' ) ) {
118+ await error . ctx . reply ( 'The request took too long to process. Please try again later.' ) ;
119+ }
118120 logger . error ( `Bot error occurred: ${ error . error } ` ) ;
119121 } ) ;
120122 this . _bot . use (
0 commit comments