plugins/twitter: added hook.regex for twitter URLs

Also minor changes in output formatting
This commit is contained in:
spathi-wa 2013-10-09 04:56:34 +05:30 committed by Ryan Hitchman
parent e866c432c8
commit 87a11881a4
1 changed files with 6 additions and 1 deletions

View File

@ -77,4 +77,9 @@ def twitter(inp, api_key=None):
time = strftime('%Y-%m-%d %H:%M:%S', strptime(time, '%a %b %d %H:%M:%S +0000 %Y'))
return "%s %s: %s" % (time, screen_name, text)
return "%s \x02%s\x02: %s" % (time, screen_name, text)
@hook.api_key('twitter')
@hook.regex(r'https?://twitter.com/(#!/)?([_0-9a-zA-Z]+)/status/(\d+)')
def show_tweet(match, api_key=None):
return twitter(match.group(3),api_key)