Skip to content

Instantly share code, notes, and snippets.

@Ivoz
Created April 8, 2013 05:31
Show Gist options
  • Save Ivoz/5334428 to your computer and use it in GitHub Desktop.
Save Ivoz/5334428 to your computer and use it in GitHub Desktop.
"""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