Added follower count and fancy number formatting to .twuser
This commit is contained in:
parent
75b5e2bc6d
commit
ffa63ead4a
1 changed files with 4 additions and 3 deletions
|
@ -63,6 +63,7 @@ def twitter(inp, bot=None):
|
||||||
return u"@\x02{}\x02 ({}): {} ({} ago)".format(user.screen_name, user.name, tweet.text, time)
|
return u"@\x02{}\x02 ({}): {} ({} ago)".format(user.screen_name, user.name, tweet.text, time)
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command("twinfo")
|
||||||
@hook.command
|
@hook.command
|
||||||
def twuser(inp, bot=None):
|
def twuser(inp, bot=None):
|
||||||
"twuser <user> -- Get info on the Twitter user <user>"
|
"twuser <user> -- Get info on the Twitter user <user>"
|
||||||
|
@ -74,7 +75,7 @@ def twuser(inp, bot=None):
|
||||||
oauth_secret = bot.config.get("api_keys", {}).get("twitter_access_secret")
|
oauth_secret = bot.config.get("api_keys", {}).get("twitter_access_secret")
|
||||||
|
|
||||||
if not consumer_key:
|
if not consumer_key:
|
||||||
return "Error: No Twitter API details."
|
return "Error: No Twitter API details."
|
||||||
|
|
||||||
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
|
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
|
||||||
auth.set_access_token(oauth_token, oauth_secret)
|
auth.set_access_token(oauth_token, oauth_secret)
|
||||||
|
@ -90,5 +91,5 @@ def twuser(inp, bot=None):
|
||||||
else:
|
else:
|
||||||
return "Unknown error"
|
return "Unknown error"
|
||||||
|
|
||||||
return u"@\x02{}\x02 ({}) is located in \x02{}\x02 and has \x02{}\x02 tweet(s). The users description is \"{}\" " \
|
return u"@\x02{}\x02 ({}) is located in \x02{}\x02 and has \x02{:,}\x02 tweets and \x02{:,}\x02 followers. The users description is \"{}\" " \
|
||||||
"".format(user.screen_name, user.name, user.location, user.statuses_count, user.description)
|
"".format(user.screen_name, user.name, user.location, user.statuses_count, user.followers_count, user.description)
|
||||||
|
|
Reference in a new issue