tg_rss_bot/bot.py
Miroslavsckaya e0992b2351
All checks were successful
continuous-integration/drone/push Build is passing
Migrate to PostgreSQL (#39)
Reviewed-on: #39
Reviewed-by: Alexey Skobkin <skobkin-ru@ya.ru>
2022-07-14 01:53:53 +03:00

26 lines
603 B
Python

import logging
import os
from dotenv import load_dotenv
from database import Database
from telegram import CommandProcessor
load_dotenv()
token = os.getenv('RSSBOT_TG_TOKEN')
dsn = os.getenv('RSSBOT_DSN')
log_level = os.getenv('LOG_LEVEL', 'INFO')
print('Starting the bot with logging level', log_level.upper())
logging.basicConfig(
level=log_level.upper(),
format='%(asctime)s: <%(name)s> [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
db = Database(dsn, logging.getLogger('Database'))
bot = CommandProcessor(token, db, logging.getLogger('CommandProcessor'))
bot.run()