added trends

master
Gavin Gilmour 2011-08-12 09:18:56 +01:00
parent 763d6b9e8b
commit 64a0483586
1 changed files with 19 additions and 0 deletions

View File

@ -289,6 +289,25 @@ class Twitter(callbacks.Plugin):
irc.reply(reply)
replies = wrap(replies, ['channel', getopts({'since': 'int'})])
@internationalizeDocstring
def trends(self, irc, msg, args, channel):
"""[<channel>]
Current trending topics
If <channel> is not given, it defaults to the current channel.
"""
api = self._getApi(channel)
try:
trends = api.GetTrendsCurrent()
except twitter.TwitterError:
irc.error(_('No tweets'))
return
reply = ' | '.join([x.name for x in trends])
reply = reply.encode('utf8')
irc.reply(reply)
trends = wrap(trends, ['channel'])
@internationalizeDocstring
def follow(self, irc, msg, args, channel, user):
"""[<channel>] <user>