if the user has no location/description, don't show it

This commit is contained in:
Luke Rogers 2013-09-10 14:49:33 +12:00
parent 285c61fe11
commit b42aac00d5

View file

@ -130,6 +130,16 @@ def twuser(inp, bot=None):
else:
prefix = ""
return u"{}@\x02{}\x02 ({}) is located in \x02{}\x02 and has \x02{:,}\x02 tweets and \x02{:,}\x02 followers. The users description is \"{}\" " \
"".format(prefix, user.screen_name, user.name, user.location, user.statuses_count, user.followers_count,
user.description)
if user.location:
loc_str = " is located in \x02{}\x02 and".format(user.location)
else:
loc_str = ""
if user.description:
desc_str = " The users description is \"{}\"".format(user.description)
else:
desc_str = ""
return u"{}@\x02{}\x02 ({}){} has \x02{:,}\x02 tweets and \x02{:,}\x02 followers.{}" \
"".format(prefix, user.screen_name, user.name, loc_str, user.statuses_count, user.followers_count,
desc_str)