diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77dfa88 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*config.env \ No newline at end of file diff --git a/bot.py b/bot.py index b14d241..56aa648 100644 --- a/bot.py +++ b/bot.py @@ -2,11 +2,20 @@ from telegram.ext import Updater,CommandHandler,run_async import ariaTools import logging import gdriveTools +import ConfigParser + +config = ConfigParser.ConfigParser() + +config.read('config.env') logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) +if (getConfig('_____REMOVE_THIS_LINE_____')): + logging.ERROR('The README.md file there to be read! Exiting now!') +def getConfig(var: str): + return config.get('BOT', var) @run_async def start(update, context): @@ -29,7 +38,7 @@ def mirror(update,context): def main(): - BOT_TOKEN = "976868081:AAEO--j0dqomyy0ZOYD0sSIGim4UHTYQg5E" + BOT_TOKEN = getConfig('BOT_TOKEN') updater = Updater(token=BOT_TOKEN, use_context=True) start_handler = CommandHandler('start', start) diff --git a/config_sample.env b/config_sample.env new file mode 100644 index 0000000..797c5d6 --- /dev/null +++ b/config_sample.env @@ -0,0 +1,6 @@ +#Remove this line before deploying +_____REMOVE_THIS_LINE_____=True +[BOT] + +# ENTER BOT TOKEN( Get it from https://my.telegram.org) +BOT_TOKEN="" \ No newline at end of file