forked from sopel-irc/sopel-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuckingweather.py
31 lines (27 loc) · 881 Bytes
/
fuckingweather.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
fuckingweather.py - Willie module for The Fucking Weather
Copyright 2013 Michael Yanovich
Copyright 2013 Edward Powell
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net
"""
from willie.module import commands, rate, priority, NOLIMIT
from willie import web
import re
@commands('fucking_weather', 'fw')
@rate(30)
@priority('low')
def fucking_weather(bot, trigger):
text = trigger.group(2)
if not text:
bot.reply("INVALID FUCKING PLACE. PLEASE ENTER A FUCKING ZIP CODE, OR A FUCKING CITY-STATE PAIR.")
return
text = web.quote(text)
page = web.get("http://thefuckingweather.com/?where=%s" % (text))
re_mark = re.compile('<p class="remark">(.*?)</p>')
results = re_mark.findall(page)
if results:
bot.reply(results[0])
else:
bot.reply("I CAN'T GET THE FUCKING WEATHER.")
return bot.NOLIMIT