From 36f2be356169528b44d0904fd652fc0be5b1fa51 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sat, 19 Dec 2020 13:43:44 -0500 Subject: [PATCH] fix autosuggestion issue, and some refactoring --- tallbot.py | 16 +++++++--------- 1 file 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.summary(search, sentences=sen) logging.info(str(pid) + " | " + search) + return " " + 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]) -- 2.39.2