Added a config file for chat id and token. Updated the readme.

master
Matt Theissen 3 years ago
parent 28d590beb8
commit fca777c44c

@ -6,3 +6,9 @@ When it finds a new image it sends it to the group.
pip install watchdog pip install watchdog
pip install pyTelegramBotAPI pip install pyTelegramBotAPI
Create a file named config_bot.py with the following variables set.
botToken
chatId

@ -1,10 +1,13 @@
#!/usr/bin/python3 #!/usr/bin/python3
import telebot import telebot
import sys
sys.path.append("bot_config")
import bot_config as i
botToken = i.botToken
botToken = "5698919505:AAFQEQEzxxw7elxQItir4ofTF4KulCmDTLE"
bot = telebot.TeleBot(botToken) bot = telebot.TeleBot(botToken)
chatId = "-752937487" chatId = i.chatId
import time import time
from watchdog.observers import Observer from watchdog.observers import Observer
@ -18,6 +21,7 @@ if __name__ == "__main__":
my_event_handler = PatternMatchingEventHandler(patterns, ignore_patterns, ignore_directories, case_sensitive) my_event_handler = PatternMatchingEventHandler(patterns, ignore_patterns, ignore_directories, case_sensitive)
def on_created(event): def on_created(event):
time.sleep(1)
bot.send_photo(chat_id=chatId, photo=open(event.src_path, 'rb')) bot.send_photo(chat_id=chatId, photo=open(event.src_path, 'rb'))
my_event_handler.on_created = on_created my_event_handler.on_created = on_created