if __name__ == "__main__":
    try:
        from config import Config
        args = parse_args()
        directory = os.path.dirname(sys.argv[0])
        if not directory.startswith('/'):
            directory = os.path.abspath("{}/{}".format(os.getcwd(),
                                                       directory
                                                       ))
        config = Config()
        if os.path.exists('./rtmbot.conf'):
            config.load_yaml(args.config or 'rtmbot.conf')

        else:
            config.load_os_environ_vars('FB__')

        logging.basicConfig(stream=sys.stdout, filename='debug.log',
                            level=logging.DEBUG if config["DEBUG"] else logging.INFO)
        logging.info('Bot is')
        token = config["SLACK_TOKEN"]
        debug = config["DEBUG"]

        bot = RtmBot(token)
        site_plugins = []
        files_currently_downloading = []
        job_hash = {}

        if config["DAEMON"] in ['True', True]:
            import daemon
            with daemon.DaemonContext():