Skip to content

Commit 9cb74ed

Browse files
committedMar 29, 2014
<PilzAdam> its funny how everyone first tries !tw @foo instead of !tw foo
1 parent 0f04eb1 commit 9cb74ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎twitter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import re, time
1212
import web
1313

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

8080
arg = arg.strip()
8181
if isinstance(arg, unicode):
@@ -84,12 +84,12 @@ def twitter(phenny, input):
8484
if arg.isdigit():
8585
phenny.say(id_tweet(arg))
8686
elif r_username.match(arg):
87-
phenny.say(user_tweet(arg))
87+
phenny.say(user_tweet(arg[1:]))
8888
elif r_link.match(arg):
8989
username = arg.split('/')[3]
9090
tweet = read_tweet(arg)
9191
phenny.say(format(tweet, username))
92-
else: phenny.reply("Give me a link, a username, or a tweet id")
92+
else: phenny.reply("Give me a link, a @username, or a tweet id")
9393

9494
twitter.commands = ['tw', 'twitter']
9595
twitter.thread = True

0 commit comments

Comments
 (0)
Please sign in to comment.