d47c384c by Barry

Bug fixes for !question

1 parent f74c5381
......@@ -586,14 +586,17 @@ Stuff:
for pod in res.pods:
if pod.text:
pod_text += pod.text
client.send_message(message.channel, '{} {}.'.format(message.author.mention(), pod_text[:1000]))
client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(pod_text[:1500])))
else:
tagged_sent = pos_tag(question.replace('?', '').split())
proper_nouns = [word for word, pos in tagged_sent if pos == 'NNP']
wiki_search = " ".join(proper_nouns)
print "Looking up {}".format(wiki_search)
wiki_out = wikipedia.summary(wiki_search, sentences=3)
client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(wiki_out)))
if wiki_search.strip() != "":
print "Looking up {}".format(wiki_search)
wiki_out = wikipedia.summary(wiki_search, sentences=3)
client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(wiki_out)))
else:
client.send_message(message.channel, 'I don\'t know {}.'.format(message.author.mention()))
return
except Exception as e:
print(format_exception(e))
......