forked from sopel-irc/sopel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fuckingweather] Add The Fucking Weather module from yano
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
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 import web | ||
import re | ||
|
||
def fucking_weather(willie, trigger): | ||
text = trigger.group(2) | ||
if not text: | ||
willie.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: | ||
willie.reply(results[0]) | ||
else: | ||
willie.reply("I CAN'T GET THE FUCKING WEATHER.") | ||
fucking_weather.commands = ['fucking_weather', 'fw'] | ||
fucking_weather.rate = 30 | ||
fucking_weather.priority = 'low' |