@@ -33,7 +33,7 @@ public function handle(Nutgram $bot): int
3333
3434 $ this ->info ('Watching for changes... ' );
3535
36- if (!$ this ->startAsyncRun ()){
36+ if (!$ this ->startAsyncRun ()) {
3737 return Command::FAILURE ;
3838 }
3939
@@ -49,20 +49,20 @@ protected function startAsyncRun(): bool
4949 ->setTimeout (null );
5050
5151 $ this ->runProcess ->start (function (string $ type , string $ output ) {
52- if (Process::isTtySupported () && !$ this ->option ('without-tty ' )) {
52+ if (Process::isTtySupported () && !$ this ->option ('without-tty ' )) {
5353 $ this ->output ->write ($ output );
5454 }
5555 });
5656
57- return ! $ this ->runProcess ->isTerminated ();
57+ return !$ this ->runProcess ->isTerminated ();
5858 }
5959
6060 protected function listenForChanges (): self
6161 {
62- Watch::paths (...config ('nutgram.watch_paths ' , []))
62+ Watch::paths (...config ('nutgram.watch.paths ' , []))
6363 ->setIntervalTime (200 * 1000 )
6464 ->onAnyChange (function (string $ event , string $ path ) {
65- if ($ this ->isPhpFile ($ path )) {
65+ if ($ this ->hasValidExtension ($ path )) {
6666 $ this ->restartAsyncRun ();
6767 }
6868 })
@@ -71,9 +71,11 @@ protected function listenForChanges(): self
7171 return $ this ;
7272 }
7373
74- protected function isPhpFile (string $ path ): bool
74+ protected function hasValidExtension (string $ path ): bool
7575 {
76- return str_ends_with (strtolower ($ path ), '.php ' );
76+ return collect (config ('nutgram.watch.extensions ' , ['php ' ]))
77+ ->map (fn (string $ ext ) => sprintf (".%s " , strtolower ($ ext )))
78+ ->contains (fn (string $ ext ) => str_ends_with (strtolower ($ path ), $ ext ));
7779 }
7880
7981 protected function restartAsyncRun (): self
0 commit comments