Separate credentials from code
This commit is contained in:
parent
5da3f5139e
commit
44fff43553
|
|
@ -0,0 +1 @@
|
|||
*config.env
|
||||
11
bot.py
11
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)
|
||||
|
|
|
|||
|
|
@ -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=""
|
||||
Loading…
Reference in New Issue