]> git.armaanb.net Git - tall.bot.git/commitdiff
fix autosuggestion issue, and some refactoring
authorArmaan Bhojwani <code@armaanb.net>
Sat, 19 Dec 2020 18:43:44 +0000 (13:43 -0500)
committerArmaan Bhojwani <code@armaanb.net>
Sat, 19 Dec 2020 18:43:44 +0000 (13:43 -0500)
tallbot.py

index b27e3ba17a6d1fd4cb094c969cf1d5a205701760..371c048bc9162cc6aa1423d8fd1382680d0a4d62 100755 (executable)
@@ -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])