Make .tfw only work for zip codes
This commit is contained in:
@@ -11,7 +11,12 @@ import lxml.html
|
||||
|
||||
def tfw(phenny, input):
|
||||
zipcode = input.group(2)
|
||||
|
||||
try:
|
||||
zipcode = int(zipcode)
|
||||
except ValueError:
|
||||
phenny.say("Sorry, .tfw only supports zip codes")
|
||||
return
|
||||
|
||||
req = urlopen("http://thefuckingweather.com/?zipcode=%d" % zipcode)
|
||||
doc = lxml.html.parse(req)
|
||||
@@ -36,7 +41,7 @@ def tfw(phenny, input):
|
||||
|
||||
response = "%s %s - %s - %s" % (temp, comment, remark, location)
|
||||
phenny.say(response)
|
||||
tfw.rule = (['tfw'], r'(.*)')
|
||||
tfw.rule = (['tfw'], r'(\d*)')
|
||||
|
||||
if __name__ == '__main__':
|
||||
print __doc__.strip()
|
||||
|
||||
Reference in New Issue
Block a user