mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 22:51:01 +01:00
Removed length restriction from deepthought.
This commit is contained in:
parent
7dfeb8d486
commit
9eb08fa205
@ -90,16 +90,16 @@ class Http(callbacks.Privmsg):
|
|||||||
Returns a Deep Thought by Jack Handey.
|
Returns a Deep Thought by Jack Handey.
|
||||||
"""
|
"""
|
||||||
url = 'http://www.tremorseven.com/aim/deepaim.php?job=view'
|
url = 'http://www.tremorseven.com/aim/deepaim.php?job=view'
|
||||||
thought = ' ' * 512
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
thought = None
|
||||||
while self.deepthoughtq and now - self.deepthoughtq[0][0] > 86400:
|
while self.deepthoughtq and now - self.deepthoughtq[0][0] > 86400:
|
||||||
s = self.deepthoughtq.dequeue()[1]
|
s = self.deepthoughtq.dequeue()[1]
|
||||||
self.deepthoughts.remove(s)
|
self.deepthoughts.remove(s)
|
||||||
while len(thought) > 430 or thought in self.deepthoughts:
|
while thought is None or thought in self.deepthoughts:
|
||||||
fd = urllib2.urlopen(url)
|
fd = urllib2.urlopen(url)
|
||||||
s = fd.read()
|
s = fd.read()
|
||||||
thought = s.split('<br>')[2]
|
thought = s.split('<br>')[2]
|
||||||
thought = ' '.join(thought.split())
|
thought = utils.normalizeWhitespace(thought)
|
||||||
self.deepthoughtq.enqueue((now, thought))
|
self.deepthoughtq.enqueue((now, thought))
|
||||||
self.deepthoughts.add(thought)
|
self.deepthoughts.add(thought)
|
||||||
irc.reply(msg, thought)
|
irc.reply(msg, thought)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user