From 4af7c9fbcfb6d7db7991bac19688eb30d77093aa Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Mon, 3 Apr 2017 16:53:39 +0200 Subject: [PATCH] Improve mention handling. More code = sometimes better. --- bottools/methods.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bottools/methods.py b/bottools/methods.py index 00d65a3..e86db4a 100644 --- a/bottools/methods.py +++ b/bottools/methods.py @@ -332,12 +332,12 @@ def getMentions(tweet, two, args = []): for m in re.split('[^\w@]+', text): try: - if m[0] == "@" and m[0].strip() != "" and not (m in args or m.strip() == "" or m == "@%s" % two.whoami().strip("@") or m == "@%s" % sender.strip("@")): + if m[0] == "@" and m[0].strip() != "" and not (m in mentions or m in args or m.strip() == "" or m == "@%s" % two.whoami().strip("@") or m == "@%s" % sender.strip("@")): mentions += [m] except: pass - if not sender.strip("@") == two.whoami().strip("@"): + if not sender.strip("@") == two.whoami().strip("@") and not "@%s" % sender.strip("@") in mentions: mentions = ["@%s" % sender.strip("@")] + mentions return mentions