]> git.armaanb.net Git - tall.bot.git/commitdiff
Update style according to Flake8
authorArmaan Bhojwani <me@armaanb.net>
Tue, 26 Jan 2021 05:07:24 +0000 (00:07 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 26 Jan 2021 05:07:24 +0000 (00:07 -0500)
tallbot.py

index fba1c1639eb445f2ec52de26a9f36e087525e174..1b184f24b0444012d66398813e6c22afbff40309 100755 (executable)
@@ -2,6 +2,7 @@
 # tall.bot - a simple Discord Wikipedia bot
 # Armaan Bhojwani 2021
 
+
 import logging
 import sqlite3
 import sys
@@ -9,9 +10,11 @@ import time
 import wikipedia
 import discord
 
+
 def wiki_sum(search, sen, pid):
     try:
-        logging.info(str(pid) + " | " + str(int(time.time())) + " | " + str(search))
+        logging.info(str(pid) + " | " + str(int(time.time())) + " | " +
+                     str(search))
         log_query(search, pid)
         return "<Wikipedia> " + wikipedia.summary(search,
                                                   sentences=sen,
@@ -20,6 +23,7 @@ def wiki_sum(search, sen, pid):
         logging.debug(str(pid) + " | " + str(search) + " | " + str(e))
         return str(e)
 
+
 def create_query(inp):
     key1 = ["What", "what", "who", "Who", "what's", "What's", "whats", "Whats",
             "Whatsa", "whatsa"]
@@ -36,6 +40,7 @@ def create_query(inp):
 
     return " ".join(x)
 
+
 def tell_more(inp, pid):
     def find_query(inp):
         key1 = ["Tell me more", "tell me more"]
@@ -57,6 +62,7 @@ def tell_more(inp, pid):
     else:
         return False
 
+
 def prep_database():
     c.execute("""CREATE TABLE IF NOT EXISTS queries(
               time INTEGER,
@@ -64,6 +70,7 @@ def prep_database():
               query TEXT)""")
     conn.commit()
 
+
 def log_query(search, pid):
     c.execute("DELETE FROM queries WHERE pid = (?)", (str(pid),))
     c.execute("""INSERT INTO queries
@@ -71,6 +78,7 @@ def log_query(search, pid):
               (int(time.time()), str(pid), str(search)))
     conn.commit()
 
+
 class TallBot(discord.Client):
     async def on_ready(self):
         logging.info('Logged in as ', self.user)
@@ -86,10 +94,12 @@ class TallBot(discord.Client):
         elif more_info:
             await message.channel.send(wiki_sum(more_info, 6, message.author))
 
+
 def main():
     prep_database()
     TallBot().run(sys.argv[1])
 
+
 if __name__ == "__main__":
     conn = sqlite3.connect("queries.db")
     c = conn.cursor()