def __init__(self, bot, prefix, command, rest): self.bot = bot self.prefix = prefix if prefix: self.nick, self.userhost = parse_prefix(self.prefix) self.command = command self.rest = rest params = {} params.update(empty_parameters) params.update(parse_parameters(self.command, self.rest)) params['channel'] = self.bot.plugins.channels.get(params['channel']) self.__dict__.update(params)
def test_parse_prefix(): assert parse_prefix('localhost.localdomain') == ('localhost.localdomain', None) assert parse_prefix('kirkeby!~kirkeby') == ('kirkeby', '~kirkeby') assert parse_prefix('x!y@z') == ('x', 'y@z')