Esempio n. 1
0
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
Esempio n. 2
0
def slackClient():
    from SlackBot import SlackBot
    import creds as config
    return SlackBot(config.slack['token'])
Esempio n. 3
0
 def __init__(self):
     self.slackBot = SlackBot()
     self.predictions = [
         False for _ in range(Notificator.PREDICTIONS_LENGTH)
     ]
     self.lastNotificationTime = time.time()
Esempio n. 4
0
def runSlackBot():

    slackbot = SlackBot();
    slackbot.run();