]> jfr.im git - erebus.git/blobdiff - modules/reddark.py
allow modules to specify that a message should be sent as NOTICE vs PRIVMSG
[erebus.git] / modules / reddark.py
index 0ade6d3824bb3d28e79863f39e9e42ebe21789d7..22383e746b75ce4e0d8dfb60b00f33eab988bdc4 100644 (file)
@@ -50,6 +50,9 @@ def chan():
 def bot():
        return chan().bot
 
+def chanmsg(message):
+       return chan().msg(message, truncate=True, msgtype="NOTICE")
+
 def debug(message, send_to_owner=True):
        if lib.parent is None:
                print(message)
@@ -86,11 +89,11 @@ def handleDelta(message):
        if message['state'] == 'private':
                message['text'] = getText(message['name'])
                print(repr(message))
-               chan().msg('[%(section)s] %(name)s went %(state)s (was: %(previous_state)s) (https://old.reddit.com/%(name)s)%(text)s' % message, truncate=True)
+               chanmsg('[%(section)s] %(name)s went %(state)s (was: %(previous_state)s) (https://old.reddit.com/%(name)s)%(text)s' % message)
        elif message['state'] == 'restricted':
-               chan().msg('[%(section)s] %(name)s went %(state)s (was: %(previous_state)s) (https://old.reddit.com/%(name)s)' % message, truncate=True)
+               chanmsg('[%(section)s] %(name)s went %(state)s (was: %(previous_state)s) (https://old.reddit.com/%(name)s)' % message)
        else:
-               chan().msg('[%(section)s] %(name)s went \x02%(state)s\x02 (was: %(previous_state)s) (https://old.reddit.com/%(name)s)' % message, truncate=True)
+               chanmsg('[%(section)s] %(name)s went \x02%(state)s\x02 (was: %(previous_state)s) (https://old.reddit.com/%(name)s)' % message)
 
 def handleState(message):
        global last_update, last_topic