|
@@ -4,18 +4,19 @@ from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
|
|
|
import handlers as hnd
|
|
|
from tale_handler import TaleHandler
|
|
|
import os
|
|
|
+import logging
|
|
|
+logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
|
+ level=logging.INFO)
|
|
|
|
|
|
-path_to_token = '/usr/local/etc/lcmbot/token'
|
|
|
+
|
|
|
+
|
|
|
+#acquire token from environment variable LCMBOT_TOKEN (string type)
|
|
|
+lcmbot_token = os.environ.get('LCMBOT_TOKEN')
|
|
|
|
|
|
def main():
|
|
|
# create LCMbot
|
|
|
- if os.path.isfile(path_to_token):
|
|
|
- with open(path_to_token) as f:
|
|
|
- TOKEN = f.readline().rstrip('\n')
|
|
|
- else:
|
|
|
- raise Exception('File "' + path_to_token + '" is missing')
|
|
|
|
|
|
- updater = Updater(TOKEN)
|
|
|
+ updater = Updater(lcmbot_token, use_context=True)
|
|
|
dp = updater.dispatcher
|
|
|
|
|
|
# register handlers
|