From b42aac00d5aa77820a6e6123e0b5405898918652 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 10 Sep 2013 14:49:33 +1200 Subject: [PATCH] if the user has no location/description, don't show it --- plugins/twitter.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/twitter.py b/plugins/twitter.py index bc402cf..c6e9cde 100755 --- a/plugins/twitter.py +++ b/plugins/twitter.py @@ -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)