Improve mention handling. More code = sometimes better.

This commit is contained in:
Klaus-Uwe Mitterer 2017-04-03 16:53:39 +02:00
parent 30ded484e0
commit 4af7c9fbcf

View file

@ -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