Created
April 8, 2013 05:31
-
-
Save Ivoz/5334428 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Modum | |
Usage: | |
modum [options] | |
modum -h | --help | |
modum -v | --version | |
Options: | |
-h --help Show this screen. | |
-v --version Show version. | |
-c FILE --config=FILE configuration file to use [default: ./config.json] | |
-d DIR --data=DIR configuration file to use [default: ./data] | |
""" | |
import os | |
from docopt import docopt | |
from config import Config | |
from client import Client | |
__version__ = '0.1-dev' | |
class Modum(object): | |
"""Modum, the raurcous IRC bot""" | |
def __init__(self, config, data): | |
file_dir = os.path.dirname(os.path.realpath(filepath)) | |
config_path = os.path.join(file_dir, args.config) | |
data_path = os.path.join(file_dir, args.data) | |
self.conf = Config(config_path, data_path) | |
self.daemonized = args.daemon | |
self.clients = {} | |
for name, client in self.conf.clients.items(): | |
self.clients[name] = Client(name, self.conf) | |
def run(self): | |
"""Main method to start modum up""" | |
print("Bootin' this bitch up...") | |
instances = [] | |
for client in self.clients.values(): | |
instances.append(client.start()) | |
[instance.join() for instance in instances] | |
def start(doc=__doc__, version=__version__): | |
args = docopt(doc, version) | |
print(args) | |
if __name__ == '__main__': | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment