tg_rss_bot/bot.py
Alexey Skobkin 2e44df0bbd
All checks were successful
continuous-integration/drone/push Build is passing
#2 #7 Telegram module (#10)
`telegram` module. Closes #2 #7.

Two service classes:

* `Notifier` class
* `CommandProcessor` class

Two [middlewares](https://github.com/eternnoir/pyTelegramBotAPI/tree/master/examples/middleware):

* `UserAuthMiddleware`
* `ExceptionHandlerMiddleware`

One exception for usage in the code called by the bot:

* `DisplayableException`

Merge **ONLY** after #9 is merged.

Reviewed-on: #10
Reviewed-by: Miroslavsckaya <miroslavsckaya@noreply.git.skobk.in>
2022-05-30 23:54:26 +03:00

19 lines
322 B
Python

import logging
import os
from dotenv import load_dotenv
from database import Database
from telegram import CommandProcessor
load_dotenv()
token = os.getenv('TELEGRAM_TOKEN')
db_path = os.getenv('DATABASE_PATH')
db = Database(db_path)
bot = CommandProcessor(token, db)
logging.info("Starting Telegram bot")
bot.run()