diff --git a/pyromancer/commands/test_examples.py b/pyromancer/commands/test_examples.py index 5af8c4d..ef7aea7 100644 --- a/pyromancer/commands/test_examples.py +++ b/pyromancer/commands/test_examples.py @@ -15,3 +15,8 @@ def greeting(match): def say(match): for part in match[1].split(', '): yield 'Saying {}', part + + +@command(r'colors') +def colors(match): + return '{u}{k}04C{k}05o{k}06l{k}o{k}07r{k}08{k}09s{k}!' diff --git a/pyromancer/objects.py b/pyromancer/objects.py index 77f1808..e932ec9 100644 --- a/pyromancer/objects.py +++ b/pyromancer/objects.py @@ -204,12 +204,20 @@ def msg(self, message, *args, **kwargs): self.line.target if not raw: + kw = { + 'm': self, + 'b': chr(2), + 'k': chr(3), + 'u': chr(31), + } + kw.update(kwargs) + try: - message = message.format(*args, m=self, **kwargs) + message = message.format(*args, **kw) except IndexError: if len(args) == 1 and isinstance(args[0], list): # Message might be: msg, [arg1, arg2], kwargs - message = message.format(*args[0], m=self, **kwargs) + message = message.format(*args[0], **kw) else: raise