1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Added examples and made it possible to specify --path path for path

This commit is contained in:
coder2020official
2022-10-01 21:28:53 +04:00
parent ea69b8093d
commit 27e0197855
4 changed files with 61 additions and 2 deletions

View File

@ -896,7 +896,9 @@ class TeleBot:
self.event_handler = EventHandler()
path = path_to_watch if path_to_watch else None
if path is None:
path = sys.argv[1] if len(sys.argv) > 1 else '.' # current directory
# Make it possible to specify --path argument to the script
path = sys.argv[sys.argv.index('--path') + 1] if '--path' in sys.argv else '.'
self.observer = Observer()
self.observer.schedule(self.event_handler, path, recursive=True)

View File

@ -230,7 +230,8 @@ class AsyncTeleBot:
self.event_handler = EventHandler()
path = path_to_watch if path_to_watch else None
if path is None:
path = sys.argv[1] if len(sys.argv) > 1 else '.' # current directory
# Make it possible to specify --path argument to the script
path = sys.argv[sys.argv.index('--path') + 1] if '--path' in sys.argv else '.'
self.observer = Observer()
self.observer.schedule(self.event_handler, path, recursive=True)