Ejemplo n.º 1
0
class TelegramNotifier(BaseNotification):
    def __init__(self):
        self.settings = TelegramSettings()

    def send_notification(self, tweets):
        self._refresh_settings()
        if not self.settings.isenabled:
            return

        bot = telegram.Bot(token=self.settings.token)
        for receiver in self.settings.receivers:
            bot.sendMessage(chat_id=receiver, text=self.settings.message)

    def _refresh_settings(self):
        self.settings.refresh()
Ejemplo n.º 2
0
 def __init__(self):
     self.settings = TelegramSettings()