Removed deepthought command now that we have a supyfact for it.

This commit is contained in:
Jeremy Fincher 2003-09-13 13:39:41 +00:00
parent caa099dfc1
commit 358533b335
2 changed files with 0 additions and 27 deletions

View File

@ -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):

View File

@ -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')