summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <code@armaanb.net>2020-12-19 13:43:44 -0500
committerArmaan Bhojwani <code@armaanb.net>2020-12-19 13:43:44 -0500
commit36f2be356169528b44d0904fd652fc0be5b1fa51 (patch)
tree2909f1f898a3fef5c6d85a54cacf9c7ab86b10bc
parentd470b39c98fa558e8485f8189050abb52d34a905 (diff)
downloadtall.bot-36f2be356169528b44d0904fd652fc0be5b1fa51.tar.gz
fix autosuggestion issue, and some refactoring
-rwxr-xr-xtallbot.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/tallbot.py b/tallbot.py
index b27e3ba..371c048 100755
--- a/tallbot.py
+++ b/tallbot.py
@@ -2,8 +2,8 @@
# tall.bot - a simple Discord Wikipedia bot
# Armaan Bhojwani 2020
-import sys
import logging
+import sys
import wikipedia
import discord
@@ -13,15 +13,14 @@ keywords = ["what is", "What is", "what was", "What was", "what were",
def wiki_sum(search, sen, pid):
search = " ".join(search)
-
try:
- output = "<Wikipedia> " + wikipedia.summary(search, sentences=sen)
logging.info(str(pid) + " | " + search)
+ return "<Wikipedia> " + wikipedia.summary(search,
+ sentences=sen,
+ auto_suggest=False)
except Exception as e:
- output = str(e)
- logging.info(str(pid) + " | " + search + " | " + str(e))
-
- return output
+ logging.debug(str(pid) + " | " + search + " | " + str(e))
+ return str(e)
def keyword_check(inp):
x = inp.split()
@@ -44,5 +43,4 @@ class TallBot(discord.Client):
2,
message.author))
-client = TallBot()
-client.run(sys.argv[1])
+TallBot().run(sys.argv[1])