diff --git a/examples/data/config/ASCII.json b/examples/data/config/ASCII.json index 41b4349..33a770b 100644 --- a/examples/data/config/ASCII.json +++ b/examples/data/config/ASCII.json @@ -1,5 +1,6 @@ { "line_delay": 1.1, "allow_parallel": false, + "allow_hilight": true, "list_max": 15 } diff --git a/examples/data/data/ASCII/locktronic.txt b/examples/data/data/ASCII/blocktronicswtf4.txt similarity index 100% rename from examples/data/data/ASCII/locktronic.txt rename to examples/data/data/ASCII/blocktronicswtf4.txt diff --git a/pyircbot/modules/ASCII.py b/pyircbot/modules/ASCII.py index c6046aa..30b0f52 100644 --- a/pyircbot/modules/ASCII.py +++ b/pyircbot/modules/ASCII.py @@ -56,14 +56,16 @@ class ASCII(ModuleBase): if not self.config.get("allow_parallel") and any(self.running_asciis.values()): return - ascii_name = cmd.args.pop() + ascii_name = cmd.args.pop(0) if not RE_ASCII_FNAME.match(ascii_name): return ascii_path = self.getFilePath(ascii_name + ".txt") if os.path.exists(ascii_path): - self.running_asciis[msg.args[0]] = Thread(target=self.print_ascii, args=(ascii_path, msg.args[0]), - daemon=True) + args = [ascii_path, msg.args[0]] + if self.config.get("allow_hilight", False) and len(cmd.args) >= 1: + args.append(cmd.args.pop(0)) + self.running_asciis[msg.args[0]] = Thread(target=self.print_ascii, args=args, daemon=True) self.running_asciis[msg.args[0]].start() return @@ -72,7 +74,7 @@ class ASCII(ModuleBase): if self.running_asciis[msg.args[0]]: self.killed_channels[msg.args[0]] = True - def print_ascii(self, ascii_path, channel): + def print_ascii(self, ascii_path, channel, hilight=None): """ Print the contents of ascii_path to channel :param ascii_path: file path to the ascii art file to read and print @@ -86,6 +88,8 @@ class ASCII(ModuleBase): break if not line: line = " " + if hilight: + line = "{}: {}".format(hilight, line) self.bot.act_PRIVMSG(channel, line) if delay: sleep(delay)