Bug fixes for !question
Showing
2 changed files
with
7 additions
and
4 deletions
... | @@ -586,14 +586,17 @@ Stuff: | ... | @@ -586,14 +586,17 @@ Stuff: |
586 | for pod in res.pods: | 586 | for pod in res.pods: |
587 | if pod.text: | 587 | if pod.text: |
588 | pod_text += pod.text | 588 | pod_text += pod.text |
589 | client.send_message(message.channel, '{} {}.'.format(message.author.mention(), pod_text[:1000])) | 589 | client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(pod_text[:1500]))) |
590 | else: | 590 | else: |
591 | tagged_sent = pos_tag(question.replace('?', '').split()) | 591 | tagged_sent = pos_tag(question.replace('?', '').split()) |
592 | proper_nouns = [word for word, pos in tagged_sent if pos == 'NNP'] | 592 | proper_nouns = [word for word, pos in tagged_sent if pos == 'NNP'] |
593 | wiki_search = " ".join(proper_nouns) | 593 | wiki_search = " ".join(proper_nouns) |
594 | print "Looking up {}".format(wiki_search) | 594 | if wiki_search.strip() != "": |
595 | wiki_out = wikipedia.summary(wiki_search, sentences=3) | 595 | print "Looking up {}".format(wiki_search) |
596 | client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(wiki_out))) | 596 | wiki_out = wikipedia.summary(wiki_search, sentences=3) |
597 | client.send_message(message.channel, '{} {}.'.format(message.author.mention(), byteify(wiki_out))) | ||
598 | else: | ||
599 | client.send_message(message.channel, 'I don\'t know {}.'.format(message.author.mention())) | ||
597 | return | 600 | return |
598 | except Exception as e: | 601 | except Exception as e: |
599 | print(format_exception(e)) | 602 | print(format_exception(e)) | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment