File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -120,13 +120,20 @@ manager.isOpen().then((_) => {
120120 }
121121 } ) ;
122122
123- bot . on ( 'message' , ( msg ) => {
123+ bot . onText ( / ^ \/ h e l p $ / , async ( msg ) => {
124124 const chatId = msg . chat . id ;
125- const commands = [ "/open" , "/notify" , "/notify_closed" ] ;
125+ bot . sendMessage ( chatId , HELP_MASSAGE ) ;
126+ } ) ;
127+
128+ bot . on ( 'message' , async ( msg ) => {
129+ const chatId = msg . chat . id ;
130+ const commands = [ "/open" , "/notify" , "/notify_closed" , "/help" ] ;
126131 if ( commands . includes ( msg . text ) ) {
127132 return ;
128133 }
129- bot . sendMessage ( chatId , HELP_MASSAGE ) ;
134+ const isOpen = await manager . isOpen ( ) ;
135+ const resp = isOpen ? OPEN_MESSAGE : CLOSED_MESSAGE ;
136+ bot . sendMessage ( chatId , resp ) ;
130137 } ) ;
131138} ) ;
132139
You can’t perform that action at this time.
0 commit comments