Telegram module #10

Merged
skobkin merged 19 commits from feature_telegram into master 2022-05-30 20:54:27 +00:00
3 changed files with 36 additions and 0 deletions
Showing only changes of commit 1bdaa75668 - Show all commits

0
telegram/__init__.py Normal file
View file

View file

@ -0,0 +1,25 @@
import telebot
from telebot.types import Message
class CommandProcessor:
bot: telebot.TeleBot
def __init__(self, token: str):
self.bot = telebot.TeleBot(token)
def run(self):
self.bot.register_message_handler(commands=['help', 'start'], callback=self.__command_help)
self.bot.infinity_polling()
def __command_help(self, message: Message):
self.bot.reply_to(message, 'Commands: "/add", "/list", "/del", "/help".')
def __add_feed(self, message: Message):
self.bot.reply_to(message, 'Feed added (stub)')
def __list_feeds(self, message: Message):
self.bot.reply_to(message, 'Your feeds: (stub)')
def __delete_feed(self, message: Message):
self.bot.reply_to(message, 'Feed deleted: (stub)')

11
telegram/notifier.py Normal file
View file

@ -0,0 +1,11 @@
import telebot
class Notifier:
bot: telebot.TeleBot
def __init__(self, token: str):
self.bot = telebot.TeleBot(token)
def notify(self, chat_id: int):
self.bot.send_message(chat_id=chat_id, text="Notification stub")