@@ -171,7 +171,8 @@ export default class TelegramExecutionContext {
171171 video,
172172 } ) ;
173173} catch ( e ) {
174- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
174+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
175+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
175176 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
176177 return await this . api . sendVideo ( this . bot . api . toString ( ) , {
177178 ...options ,
@@ -237,7 +238,8 @@ export default class TelegramExecutionContext {
237238 caption,
238239 } ) ;
239240} catch ( e ) {
240- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
241+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
242+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
241243 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
242244 return await this . api . sendPhoto ( this . bot . api . toString ( ) , {
243245 ...options ,
@@ -293,7 +295,8 @@ export default class TelegramExecutionContext {
293295 caption,
294296 } ) ;
295297} catch ( e ) {
296- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
298+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
299+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
297300 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
298301 return await this . api . sendVoice ( this . bot . api . toString ( ) , {
299302 ...options ,
@@ -337,7 +340,8 @@ export default class TelegramExecutionContext {
337340 action : 'typing' ,
338341 } ) ;
339342} catch ( e ) {
340- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
343+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
344+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
341345 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
342346 return await this . api . sendChatAction ( this . bot . api . toString ( ) , {
343347
@@ -457,7 +461,8 @@ export default class TelegramExecutionContext {
457461 ...options ,
458462 } ) ;
459463 } catch ( e ) {
460- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
464+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
465+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
461466 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
462467 return await this . api . editMessageText ( this . bot . api . toString ( ) , {
463468 chat_id : this . getChatId ( ) ,
@@ -490,6 +495,7 @@ export default class TelegramExecutionContext {
490495 business_connection_id,
491496 } ) ;
492497 } catch ( e ) {
498+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
493499 if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
494500 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
495501 response = await this . api . sendMessage ( this . bot . api . toString ( ) , {
@@ -561,7 +567,8 @@ export default class TelegramExecutionContext {
561567 parse_mode,
562568 } ) ;
563569 } catch ( e ) {
564- if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
570+ if ( e instanceof Error && e . message === 'PEER_ID_INVALID' ) { console . error ( 'Peer invalid, cannot deliver message' ) ; return null ; }
571+ if ( e instanceof Error && e . message === 'BUSINESS_CONNECTION_INVALID' ) {
565572 console . warn ( 'Business connection invalid, retrying without business_connection_id' ) ;
566573 return await this . api . sendMessage ( this . bot . api . toString ( ) , {
567574 chat_id : this . getChatId ( ) ,
0 commit comments