mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Removed deepthought command now that we have a supyfact for it.
This commit is contained in:
parent
caa099dfc1
commit
358533b335
@ -79,30 +79,6 @@ class FreshmeatException(Exception):
|
|||||||
|
|
||||||
class Http(callbacks.Privmsg):
|
class Http(callbacks.Privmsg):
|
||||||
threaded = True
|
threaded = True
|
||||||
def __init__(self):
|
|
||||||
callbacks.Privmsg.__init__(self)
|
|
||||||
self.deepthoughtq = structures.queue()
|
|
||||||
self.deepthoughts = sets.Set()
|
|
||||||
|
|
||||||
def deepthought(self, irc, msg, args):
|
|
||||||
"""takes no arguments
|
|
||||||
|
|
||||||
Returns a Deep Thought by Jack Handey.
|
|
||||||
"""
|
|
||||||
url = 'http://www.tremorseven.com/aim/deepaim.php?job=view'
|
|
||||||
now = time.time()
|
|
||||||
thought = None
|
|
||||||
while self.deepthoughtq and now - self.deepthoughtq[0][0] > 86400:
|
|
||||||
s = self.deepthoughtq.dequeue()[1]
|
|
||||||
self.deepthoughts.remove(s)
|
|
||||||
while thought is None or thought in self.deepthoughts:
|
|
||||||
fd = urllib2.urlopen(url)
|
|
||||||
s = fd.read()
|
|
||||||
thought = s.split('<br>')[2]
|
|
||||||
thought = utils.normalizeWhitespace(thought)
|
|
||||||
self.deepthoughtq.enqueue((now, thought))
|
|
||||||
self.deepthoughts.add(thought)
|
|
||||||
irc.reply(msg, thought)
|
|
||||||
|
|
||||||
_titleRe = re.compile(r'<title>(.*)</title>', re.I | re.S)
|
_titleRe = re.compile(r'<title>(.*)</title>', re.I | re.S)
|
||||||
def title(self, irc, msg, args):
|
def title(self, irc, msg, args):
|
||||||
|
@ -33,9 +33,6 @@ from test import *
|
|||||||
|
|
||||||
class HttpTest(PluginTestCase, PluginDocumentation):
|
class HttpTest(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('Http',)
|
plugins = ('Http',)
|
||||||
def testDeepthought(self):
|
|
||||||
self.assertNotError('deepthought')
|
|
||||||
|
|
||||||
def testStockquote(self):
|
def testStockquote(self):
|
||||||
self.assertNotError('stockquote MSFT')
|
self.assertNotError('stockquote MSFT')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user