tg_rss_bot/bot.py

26 lines
610 B
Python
Raw Normal View History

import logging
import os
from dotenv import load_dotenv
from database import Database
from telegram import CommandProcessor
load_dotenv()
2022-07-11 00:25:44 +00:00
token = os.getenv('RSSBOT_TG_TOKEN')
db_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',
)
2022-07-11 00:25:44 +00:00
db = Database(db_dsn, logging.getLogger('Database'))
bot = CommandProcessor(token, db, logging.getLogger('CommandProcessor'))
bot.run()