X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/6501c178d17fff97a2519240311f354724c3e9e5..b68479d779c98ec06a1d66290dba8d98fb40f068:/modules/subtext.py diff --git a/modules/subtext.py b/modules/subtext.py index f07e554..3290050 100644 --- a/modules/subtext.py +++ b/modules/subtext.py @@ -1,4 +1,5 @@ # Erebus IRC bot - Author: Erebus Team +# vim: fileencoding=utf-8 # module for 's/regex/replacement/' style correction # see for usage examples: https://github.com/zonidjan/erebus/commit/d7e9802778477f1faa26a03078cb1b3c018a5e5c # This file is released into the public domain; see http://unlicense.org/ @@ -7,7 +8,7 @@ modinfo = { 'author': 'Erebus Team', 'license': 'public domain', - 'compatible': [2], # compatible module API versions + 'compatible': [0], # compatible module API versions 'depends': [], # other modules required to work properly? 'softdeps': [], # modules which are preferred but not required } @@ -32,16 +33,13 @@ def privmsg_hook(bot, line): msg = pieces[3][1:] mo = re_findsub.match(msg) if mo: - print lastline[chan] - print mo.groupdict() if mo.group('global') is not None: count = 0 # unlimited else: count = 1 # only first try: newline = re.sub(mo.group('search'), mo.group('replace'), lastline[chan].msg, count) - except Exception as e: print e; return # ignore it if it doesn't work - print newline + except Exception as e: return # ignore it if it doesn't work if newline != lastline[chan].msg: if lastline[chan].sender == fromnick: bot.msg(chan, "<%s> %s" % (lastline[chan].sender, newline))