def main(): timestamp = time.time() slack_bot_dns320 = SlackBot(slack_token, channel_id, file_with_list, dir_list_command) try: slack_bot_dns320.post_message('Ready. Type *help* to get started') while True: time.sleep(5) try: msgs = slack_bot_dns320.get_sorted_latest_messages(timestamp) if msgs: # not empty timestamp = msgs[-1]['ts'] for msg in msgs: if 'bot_message' not in msg: slack_bot_dns320.parse_command(msg['text']) except Exception as e: print e slack_bot_dns320.post_message(str(e)) except Exception as e: print e
def slackClient(): from SlackBot import SlackBot import creds as config return SlackBot(config.slack['token'])
def __init__(self): self.slackBot = SlackBot() self.predictions = [ False for _ in range(Notificator.PREDICTIONS_LENGTH) ] self.lastNotificationTime = time.time()
def runSlackBot(): slackbot = SlackBot(); slackbot.run();