File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ import { isNone } from '../types/option';
1919async function handlerSendError ( e : any , userId : number ) : Promise < boolean > {
2020 // bot was blocked or chat is deleted
2121 logger . error ( e ) ;
22- const re = / c h a t n o t f o u n d | b o t w a s b l o c k e d b y t h e u s e r | b o t w a s k i c k e d | u s e r i s d e a c t i v a t e d / ;
23- if ( config . delete_on_err_send && re . test ( e . description ) ) {
22+ if ( config . delete_on_err_send && isChatUnAvailable ( e . description ) ) {
2423 logger . error ( `delete all subscribes for user ${ userId } ` ) ;
2524 deleteSubscribersByUserId ( userId ) ;
2625 }
@@ -90,4 +89,9 @@ const send = async (
9089 }
9190} ;
9291
92+ function isChatUnAvailable ( description : string ) : boolean {
93+ const re = / c h a t n o t f o u n d | b o t w a s b l o c k e d b y t h e u s e r | b o t w a s k i c k e d | u s e r i s d e a c t i v a t e d | h a v e n o r i g h t s | n e e d a d m i n i s t r a t o r r i g h t s / ;
94+ return re . test ( description ) ;
95+ }
96+
9397export default send ;
You can’t perform that action at this time.
0 commit comments