How to use the pmxbot.dictlib.ConfigDict function in pmxbot

To help you get started, we’ve selected a few pmxbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yougov / pmxbot / tests / functional / __init__.py View on Github external
self.reactor.process_once(0.1)
        self.channels = set()

    def join(self, channel):
        self.c.join(channel)
        self.channels.add(channel)

    def send_message(self, channel, message):
        if channel not in self.channels:
            self.join(channel)
        self.c.privmsg(channel, message)
        time.sleep(0.05)


class PmxbotHarness:
    config = pmxbot.dictlib.ConfigDict(
        server_port=6668,
        bot_nickname='pmxbotTest',
        log_channels=['#logged'],
        other_channels=['#inane'],
        database="sqlite:tests/functional/pmxbot.sqlite",
    )

    @classmethod
    def setup_class(cls):
        """Start an IRC server, launch the bot, and ask it to do stuff"""
        path = os.path.dirname(os.path.abspath(__file__))
        cls.config_fn = os.path.join(path, 'testconf.yaml')
        cls.config.to_yaml(cls.config_fn)
        cls.dbfile = urllib.parse.urlparse(cls.config['database']).path
        cls.db = sqlite3.connect(cls.dbfile)
        env = os.environ.copy()
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def setup_class(cls):
        path = os.path.dirname(os.path.abspath(__file__))
        configfile = os.path.join(path, 'testconf.yaml')
        config = pmxbot.dictlib.ConfigDict.from_yaml(configfile)
        cls.bot = core.initialize(config)
        logging.Logger.store.message("logged", "testrunner", "some text")
github yougov / pmxbot / pmxbot / __init__.py View on Github external
# vim:ts=4:sw=4:noexpandtab

from .dictlib import ConfigDict

config = ConfigDict(
	bot_nickname='pmxbot',
	server_host='localhost',
	server_port=6667,
	use_ssl=False,
	password=None,
	nickserv_password=None,
	silent_bot=False,
	log_channels=[],
	other_channels=[],
)
"The config object"
github yougov / pmxbot / pmxbot / core.py View on Github external
def init_config(overrides):
    """
    Install the config dict as pmxbot.config, setting overrides,
    and return the result.
    """
    pmxbot.config = config = ConfigDict()
    config.setdefault('bot_nickname', 'pmxbot')
    config.update(overrides)
    return config
github yougov / pmxbot / pmxbot / core.py View on Github external
def get_args(*args, **kwargs):
    parser = argparse.ArgumentParser()
    parser.add_argument(
        'config',
        type=pmxbot.dictlib.ConfigDict.from_yaml,
        nargs='*',
        action=ConfigMergeAction,
    )
    return parser.parse_args(*args, **kwargs)
github yougov / pmxbot / pmxbot / pmxbot.py View on Github external
def get_args():
	parser = argparse.ArgumentParser()
	parser.add_argument('config', type=dictlib.ConfigDict.from_yaml)
	return parser.parse_args()