From fca777c44c07667cf29c20d1471ab2e4795ac6ac Mon Sep 17 00:00:00 2001 From: Matt Theissen Date: Wed, 31 Aug 2022 21:55:37 -0500 Subject: [PATCH] Added a config file for chat id and token. Updated the readme. --- README.md | 6 ++++++ image_bot.py | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e63af32..c79e6a8 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,9 @@ When it finds a new image it sends it to the group. pip install watchdog pip install pyTelegramBotAPI + + +Create a file named config_bot.py with the following variables set. + +botToken +chatId diff --git a/image_bot.py b/image_bot.py index 3ec4661..cad8688 100755 --- a/image_bot.py +++ b/image_bot.py @@ -1,10 +1,13 @@ #!/usr/bin/python3 import telebot +import sys +sys.path.append("bot_config") +import bot_config as i +botToken = i.botToken -botToken = "5698919505:AAFQEQEzxxw7elxQItir4ofTF4KulCmDTLE" bot = telebot.TeleBot(botToken) -chatId = "-752937487" +chatId = i.chatId import time from watchdog.observers import Observer @@ -18,6 +21,7 @@ if __name__ == "__main__": my_event_handler = PatternMatchingEventHandler(patterns, ignore_patterns, ignore_directories, case_sensitive) def on_created(event): + time.sleep(1) bot.send_photo(chat_id=chatId, photo=open(event.src_path, 'rb')) my_event_handler.on_created = on_created