From 763d6b9e8be714107a505b47d58d42208e2b2864 Mon Sep 17 00:00:00 2001 From: Gavin Gilmour Date: Mon, 8 Aug 2011 19:07:09 +0100 Subject: [PATCH] added stats --- Twitter/plugin.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Twitter/plugin.py b/Twitter/plugin.py index 6d125d1..08110fb 100644 --- a/Twitter/plugin.py +++ b/Twitter/plugin.py @@ -360,6 +360,25 @@ class Twitter(callbacks.Plugin): ('checkChannelCapability', 'twitteradmin'), 'somethingWithoutSpaces']) + @internationalizeDocstring + def stats(self, irc, msg, args, channel): + """[] + + Print some stats + If is not given, it defaults to the current channel. + """ + api = self._getApi(channel) + try: + reply = {} + reply['followers'] = len(api.GetFollowers()) + reply['following'] = len(api.GetFriends(None)) + except twitter.TwitterError: + irc.error(_('An error occurred')) + return + reply = "I am following %d people and have %d followers" % (reply['following'], reply['followers']) + irc.reply(reply) + stats = wrap(stats, ['channel']) + def die(self): self.__parent.die()