Improve mention handling. More code = sometimes better.
This commit is contained in:
parent
30ded484e0
commit
4af7c9fbcf
|
@ -332,12 +332,12 @@ def getMentions(tweet, two, args = []):
|
||||||
|
|
||||||
for m in re.split('[^\w@]+', text):
|
for m in re.split('[^\w@]+', text):
|
||||||
try:
|
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]
|
mentions += [m]
|
||||||
except:
|
except:
|
||||||
pass
|
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
|
mentions = ["@%s" % sender.strip("@")] + mentions
|
||||||
|
|
||||||
return mentions
|
return mentions
|
||||||
|
|
Loading…
Reference in a new issue