]> jfr.im git - erebus.git/commitdiff
reddark - dont display message if its blank
authorJohn Runyon <redacted>
Thu, 15 Jun 2023 01:13:11 +0000 (19:13 -0600)
committerJohn Runyon <redacted>
Thu, 15 Jun 2023 01:13:11 +0000 (19:13 -0600)
modules/reddark.py

index fbba1e13bd9aca761ee0aeb8834846c4848a68d6..540c7502c095461c645c9603344fa51e8a82898b 100644 (file)
@@ -77,7 +77,8 @@ def getText(subreddit):
        if len(elements):
                text = elements[0].get_text()
                text = re.sub(re.escape(subreddit), '', text, re.IGNORECASE).replace("\n", " ")
-               return text
+               return ' - ' + text
+       return ''
 
 def handleDelta(message):
        message['state'] = message['state'].lower()
@@ -85,7 +86,7 @@ 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)
+               chan().msg('[%(section)s] %(name)s went %(state)s (was: %(previous_state)s) (https://old.reddit.com/%(name)s)%(text)s' % message, truncate=True)
        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)
        else: