Esempio n. 1
0
 def config(self):
     from _apis.models import Slack, Telegram
     if Slack().setup_done:
         return {"selected": "Slack", "config": Slack().config}
     elif Telegram().setup_done:
         return {"selected": "Telegram", "config": Telegram().config}
     else:
         return {}
Esempio n. 2
0
    def send(self, message):
        self.log('send()')
        from _apis.models import Slack, Telegram

        if Slack().setup_done:
            return Slack().message(message)
        elif Telegram().setup_done:
            return Telegram().message(message)
        else:
            self.log('-> ERROR: Notify setup not completed')
Esempio n. 3
0
    def setup(self):
        from pyprintplus import Log
        from _apis.models import Slack, Telegram
        try:
            if not Slack().setup_done and not Telegram().setup_done:
                Log().show_messages(
                    ['Let\'s setup notifications for your new website!'])

                Slack(test=self.test).setup()

                if not Slack().setup_done and not Telegram().setup_done:
                    Telegram(test=self.test).setup()

            Log().show_message('Notify setup complete.')
        except KeyboardInterrupt:
            Log().show_message('Ok, canceled setup.')
Esempio n. 4
0
 def setup_done(self):
     from _apis.models import Slack, Telegram
     return True if Slack().setup_done or Telegram().setup_done else False