telegram. Registering handlers in CommandProcessor. Some docstrings added.
This commit is contained in:
parent
20849ada60
commit
a3a38a856e
|
@ -3,17 +3,20 @@ from telebot.types import Message
|
|||
|
||||
|
||||
class CommandProcessor:
|
||||
"""
|
||||
Processes user input and dispatches the data to other services.
|
||||
"""
|
||||
"""Processes user input and dispatches the data to other services."""
|
||||
|
||||
bot: telebot.TeleBot
|
||||
|
||||
def __init__(self, token: str):
|
||||
self.bot = telebot.TeleBot(token)
|
||||
|
||||
"""Runs a bot and polls for new messages indefinitely."""
|
||||
def run(self):
|
||||
self.bot.register_message_handler(commands=['help', 'start'], callback=self.__command_help)
|
||||
self.bot.register_message_handler(commands=['add'], callback=self.__add_feed)
|
||||
self.bot.register_message_handler(commands=['list'], callback=self.__list_feeds)
|
||||
self.bot.register_message_handler(commands=['del'], callback=self.__delete_feed)
|
||||
|
||||
self.bot.infinity_polling()
|
||||
|
||||
def __command_help(self, message: Message):
|
||||
|
|
|
@ -2,14 +2,13 @@ import telebot
|
|||
|
||||
|
||||
class Notifier:
|
||||
"""
|
||||
Sends notifications to users about new RSS feed items.
|
||||
"""
|
||||
"""Sends notifications to users about new RSS feed items."""
|
||||
|
||||
bot: telebot.TeleBot
|
||||
|
||||
def __init__(self, token: str):
|
||||
self.bot = telebot.TeleBot(token)
|
||||
|
||||
"""Send notification to the user"""
|
||||
def notify(self, chat_id: int):
|
||||
self.bot.send_message(chat_id=chat_id, text="Notification stub")
|
||||
|
|
Loading…
Reference in a new issue