From e5c436fa3f292722f09a9a87603ed8ea0dedcce4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 25 Oct 2020 12:22:09 +0000 Subject: [PATCH] Avoid duplication --- newsdaemon.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/newsdaemon.py b/newsdaemon.py index 19f9a384..7a31d2a4 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -104,14 +104,12 @@ def hashtagRuleResolve(tree: [], hashtags: [], moderated: bool, return matchStrLower in contentWithoutTags elif tree[0] == 'from': if len(tree) == 2: + matchStr = None if isinstance(tree[1], str): matchStr = tree[1] - if matchStr.startswith('"') and matchStr.endswith('"'): - matchStr = matchStr[1:] - matchStr = matchStr[:len(matchStr) - 1] - return matchStr.lower() in url elif isinstance(tree[1], list): matchStr = tree[1][0] + if matchStr: if matchStr.startswith('"') and matchStr.endswith('"'): matchStr = matchStr[1:] matchStr = matchStr[:len(matchStr) - 1]