From a4c560baf2eba53334f8630134d02e57c24f4c54 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 6 Apr 2017 22:43:32 +0200 Subject: [PATCH] Improve mention handling. Yet again. --- bottools/methods.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bottools/methods.py b/bottools/methods.py index 619d6e8..04bb671 100644 --- a/bottools/methods.py +++ b/bottools/methods.py @@ -323,6 +323,10 @@ def explicitTweet(bot, update, args, reply = None): def getMentions(tweet, two, args = []): sender = tweet.user.screen_name + + if "@%s" % sender.strip("@") in args: + return [] + try: text = tweet.full_text except: @@ -337,7 +341,7 @@ def getMentions(tweet, two, args = []): except: pass - if not sender.strip("@") == two.whoami().strip("@") and not "@%s" % sender.strip("@") in mentions: + if not (sender.strip("@") == two.whoami().strip("@") or "@%s" % sender.strip("@") in mentions): mentions = ["@%s" % sender.strip("@")] + mentions return mentions