Skip to content

Commit

Permalink
<PilzAdam> its funny how everyone first tries !tw @foo instead of !tw…
Browse files Browse the repository at this point in the history
… foo
  • Loading branch information
sfan5 committed Mar 29, 2014
1 parent 0f04eb1 commit 9cb74ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions twitter.py
Expand Up @@ -11,7 +11,7 @@
import re, time
import web

r_username = re.compile(r'^[a-zA-Z0-9_]{1,15}$')
r_username = re.compile(r'^@[a-zA-Z0-9_]{1,15}$')
r_link = re.compile(r'^https?://twitter.com/\S+$')
r_p = re.compile(r'(?ims)(<p class="js-tweet-text.*?</p>)')
r_tag = re.compile(r'(?ims)<[^>]+>')
Expand Down Expand Up @@ -75,7 +75,7 @@ def twitter(phenny, input):
return # Abort function
arg = input.group(2)
if not arg:
return phenny.reply("Give me a link, a username, or a tweet id")
return phenny.reply("Give me a link, a @username, or a tweet id")

arg = arg.strip()
if isinstance(arg, unicode):
Expand All @@ -84,12 +84,12 @@ def twitter(phenny, input):
if arg.isdigit():
phenny.say(id_tweet(arg))
elif r_username.match(arg):
phenny.say(user_tweet(arg))
phenny.say(user_tweet(arg[1:]))
elif r_link.match(arg):
username = arg.split('/')[3]
tweet = read_tweet(arg)
phenny.say(format(tweet, username))
else: phenny.reply("Give me a link, a username, or a tweet id")
else: phenny.reply("Give me a link, a @username, or a tweet id")

twitter.commands = ['tw', 'twitter']
twitter.thread = True
Expand Down

0 comments on commit 9cb74ed

Please sign in to comment.