#!/usr/bin/env python
# coding: utf-8

from __future__ import unicode_literals, absolute_import

import thebot
import sys

from time import sleep
from contextlib import closing
from thebot import autoreload

def run_bot(*args):
    with closing(thebot.Bot(args)) as bot:
        try:
            while not bot.exiting:
                sleep(1)
        except KeyboardInterrupt:
            pass

def main():
    autoreload.main(run_bot, tuple(sys.argv[1:]))


if __name__ == '__main__':
    main()

