Moved database uri to env var

Was is config file.
This commit is contained in:
Stan James
2018-01-30 16:23:53 -07:00
parent 9153ba75b6
commit b22703e8ad
2 changed files with 9 additions and 15 deletions

10
bot.py
View File

@ -12,17 +12,10 @@ This bot logs all messages sent in a Telegram Group to a database.
from __future__ import print_function
import sys
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
import os
from model import User, Message, session
from time import strftime
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
# Define a few command handlers. These usually take the two arguments bot and
# update. Error handlers also receive the raised TelegramError object in error.
@ -95,7 +88,8 @@ def add_user(user_id, first_name, last_name, username):
def error(bot, update, error):
"""Log Errors caused by Updates."""
logger.warning('Update "%s" caused error "%s"', update, error)
print("Update '{}' caused error '{}'".format(update, error), file=sys.stderr)
def main():