changed logging method; used black formatter globally
authorGeorgios Atheridis <atheridis@tutamail.com>
Tue, 31 May 2022 15:54:14 +0000 (15:54 +0000)
committerGeorgios Atheridis <atheridis@tutamail.com>
Tue, 31 May 2022 15:54:14 +0000 (15:54 +0000)
47 files changed:
skgyorugo/analyze_auto_message.py
skgyorugo/analyze_command.py
skgyorugo/auto_messages/hello1.py
skgyorugo/auto_messages/youtube.py
skgyorugo/commands/addaccount.py
skgyorugo/commands/addcommand.py
skgyorugo/commands/cleanqueue.py
skgyorugo/commands/coin.py
skgyorugo/commands/commands.py
skgyorugo/commands/delete.py
skgyorugo/commands/editcommand.py
skgyorugo/commands/emotes.py
skgyorugo/commands/forcehere.py
skgyorugo/commands/forcejoin.py
skgyorugo/commands/forceleave.py
skgyorugo/commands/forcenothere.py
skgyorugo/commands/here.py
skgyorugo/commands/join.py
skgyorugo/commands/latege.py
skgyorugo/commands/leave.py
skgyorugo/commands/movedown.py
skgyorugo/commands/moveup.py
skgyorugo/commands/newteams.py
skgyorugo/commands/nothere.py
skgyorugo/commands/opgg.py
skgyorugo/commands/queue.py
skgyorugo/commands/removecommand.py
skgyorugo/commands/scam.py
skgyorugo/commands/spam.py
skgyorugo/commands/t.py
skgyorugo/commands/teams.py
skgyorugo/commands/teamsize.py
skgyorugo/commands/uwu.py
skgyorugo/commands/youtube.py
skgyorugo/database_manager.py
skgyorugo/lol_api/match_v5.py
skgyorugo/lol_api/spectator_v4.py
skgyorugo/lol_api/summoner_v4.py
skgyorugo/main.py
skgyorugo/requirements.txt
skgyorugo/scripts/alwase.py
skgyorugo/scripts/chatting.py
skgyorugo/scripts/clean_queue.py
skgyorugo/scripts/unit_converter.py
skgyorugo/tools/smart_start_stream_time.py
skgyorugo/variable_manager/parser.py
skgyorugo/yt_api/videos.py

index 5caed271936ce31639fd8ddedc6f9db08a4d59d9..aa8ef11d8009ad2cbac7a0ced850305fe8aaa50a 100644 (file)
@@ -11,15 +11,6 @@ reload(tools.smart_privmsg)
 reload(tools.smart_start_stream_time)
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PATH = os.path.dirname(os.path.realpath(__file__))
 logger.debug(f"analyze_auto_message PATH set to: {PATH}")
index fe8bb12a8038901daf0fcbce9fdb3bb4ee29bed6..76ba314b3e74f1e9ac2f97d250d64b124110a6d3 100644 (file)
@@ -7,15 +7,6 @@ import logging
 from aptbot.bot import Bot, Message, Commands
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PATH = os.path.dirname(os.path.realpath(__file__))
 logger.debug(f"PATH set to: {PATH}")
@@ -33,9 +24,9 @@ def do_command(bot: Bot, message: Message, command_modules: dict):
         replied_message = None
 
     if replied_message:
-        command = message.value.split(' ')[1]
+        command = message.value.split(" ")[1]
     else:
-        command = message.value.split(' ')[0]
+        command = message.value.split(" ")[0]
     prefix = command[0]
     command = command[1:]
     user_id = message.tags["user-id"]
@@ -77,23 +68,26 @@ def do_command(bot: Bot, message: Message, command_modules: dict):
             command,
             prefix,
             user_perm,
-        )
+        ),
     )
     fetched = c.fetchall()
     if not fetched:
         conn.close()
         return
 
-    (_, value,
-     command_user_cooldown,
-     command_global_cooldown,
-     avail_time) = random.choice(fetched)
+    (
+        _,
+        value,
+        command_user_cooldown,
+        command_global_cooldown,
+        avail_time,
+    ) = random.choice(fetched)
 
     if message_timestamp < avail_time:
         bot.send_privmsg(
             message.channel,
             f"The command '{prefix}{command}' is on cooldown. \
-            Please wait {int(avail_time - message_timestamp) + 1} seconds."
+            Please wait {int(avail_time - message_timestamp) + 1} seconds.",
         )
         conn.close()
         return
@@ -104,14 +98,14 @@ def do_command(bot: Bot, message: Message, command_modules: dict):
             user_id,
             command,
             command_user_cooldown + message_timestamp,
-        )
+        ),
     )
     c.execute(
         "UPDATE commands SET last_used = ? WHERE command = ?",
         (
             message_timestamp,
             command,
-        )
+        ),
     )
     conn.commit()
     conn.close()
index 939eb8e66f90710cd9ea9a8be1b723464b52aafa..78bfe96d391427b0342b30018267c92ca895b616 100644 (file)
@@ -7,4 +7,3 @@ END_TIME = 0.5 * 60 * 60
 def main(bot: Bot, message: Message):
     msg = "peepoWave"
     bot.send_privmsg(message.channel, msg)
-
index 53ca3540505276307a70128bf61d05ad0e6c6540..426f9fb51ac962e76a56b8192ef080d969d10a27 100644 (file)
@@ -11,7 +11,7 @@ def main(bot: Bot, message: Message):
     video = yt_api.videos.get_newest_video(CHANNEL_ID)
     if video:
         video_link = f"https://www.youtube.com/watch?v={video.video_id}"
-        msg = f"Watch Peks' latest video \"{video.video_name}\" here: {video_link}"
+        msg = f'Watch Peks\' latest video "{video.video_name}" here: {video_link}'
     else:
         msg = f"Check out my youtube channel here -> https://www.youtube.com/channel/{CHANNEL_ID}"
     bot.send_privmsg(message.channel, msg)
index ffccbb1477430864a8d9fe4305301d8563fa1fbd..69cdfb24189054ab75a280c70ddfa9d0651de4ff 100644 (file)
@@ -6,15 +6,6 @@ import lol_api.summoner_v4
 import ttv_api.users
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 PERMISSION = 10
index 5df96e63917350107ef4d5be6acd407defb3cadb..f430b4667c57766327b9273d1a430b1b30ac4166 100644 (file)
@@ -3,7 +3,7 @@ import sqlite3
 import os
 
 PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
 DESCRIPTION = ""
 USER_COOLDOWN = 0
 GLOBAL_COOLDOWN = 0
@@ -19,15 +19,15 @@ DEFAULT_LAST_USED = 0
 
 
 def main(bot: Bot, message: Message):
-    msg = ' '.join(message.value.split(' ')[1:])
-    command = msg.split(' ')[0]
+    msg = " ".join(message.value.split(" ")[1:])
+    command = msg.split(" ")[0]
     command_prefix = command[0]
     command_name = command[1:]
-    command_value = msg = ' '.join(msg.split(' ')[1:])
-    if command_prefix != '?':
+    command_value = msg = " ".join(msg.split(" ")[1:])
+    if command_prefix != "?":
         bot.send_privmsg(
             message.channel,
-            f"{message.nick} you cannot use {command_prefix} as a prefix"
+            f"{message.nick} you cannot use {command_prefix} as a prefix",
         )
         return
 
@@ -38,13 +38,13 @@ def main(bot: Bot, message: Message):
         (
             command_name,
             command_prefix,
-        )
+        ),
     )
     try:
         if not c.fetchone()[0]:
             bot.send_privmsg(
                 message.channel,
-                f"The command {command_prefix}{command_name} already exists"
+                f"The command {command_prefix}{command_name} already exists",
             )
             return
     except TypeError:
@@ -60,15 +60,12 @@ def main(bot: Bot, message: Message):
                 DEFAULT_USER_COOLDOWN,
                 DEFAULT_GLOBAL_COOLDOWN,
                 DEFAULT_LAST_USED,
-            )
+            ),
         )
     except sqlite3.IntegrityError:
         pass
     except Exception as e:
-        bot.send_privmsg(
-            message.channel,
-            f"There was an error adding the command: {e}"
-        )
+        bot.send_privmsg(message.channel, f"There was an error adding the command: {e}")
         conn.close()
         return
     c.execute(
@@ -76,11 +73,8 @@ def main(bot: Bot, message: Message):
         (
             command_name,
             command_value,
-        )
-    )
-    bot.send_privmsg(
-        message.channel,
-        f"Successfully added {command_name}."
+        ),
     )
+    bot.send_privmsg(message.channel, f"Successfully added {command_name}.")
     conn.commit()
     conn.close()
index 340ee6b7b0a5d482fb673e5c94ac257a3d548a61..b94131befaf4f762c216a89bd22a13d515b6cd7c 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import time
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 7fca71ab2427b68e6f63d7f07900a32f72083815..8c169407408679467fa604651e3eda1e758b4b2a 100644 (file)
@@ -3,8 +3,10 @@ import tools.smart_privmsg
 import random
 
 PERMISSION = 99
-PREFIX = '?'
-DESCRIPTION = r"Tosses a coin, there's a 50% chance it's heads and a 50% chance it's tails"
+PREFIX = "?"
+DESCRIPTION = (
+    r"Tosses a coin, there's a 50% chance it's heads and a 50% chance it's tails"
+)
 USER_COOLDOWN = 10
 GLOBAL_COOLDOWN = 5
 
@@ -12,10 +14,13 @@ GLOBAL_COOLDOWN = 5
 def main(bot: Bot, message: Message):
     r = random.random()
     if r < 0.02:
-        tools.smart_privmsg.send(bot, message, f"the coin landed on it's side, try again.", reply=message.tags["id"])
+        tools.smart_privmsg.send(
+            bot,
+            message,
+            f"the coin landed on it's side, try again.",
+            reply=message.tags["id"],
+        )
     elif r < 0.51:
         tools.smart_privmsg.send(bot, message, f"heads", reply=message.tags["id"])
     else:
         tools.smart_privmsg.send(bot, message, f"tails", reply=message.tags["id"])
-
-
index 8de41a135c4e66a0b3a0bcb4bbe0347b0c8ad22d..2c62bbedf447efe612e77f4b84c677e88c8cc04a 100644 (file)
@@ -5,7 +5,7 @@ import sqlite3
 import os
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 30
 GLOBAL_COOLDOWN = 15
@@ -19,15 +19,11 @@ def main(bot: Bot, message: Message):
     conn = sqlite3.connect(os.path.join(PATH, "database.db"))
     c = conn.cursor()
 
-    user_perm = tools.permissions.get_permission_from_id(
-        message.tags["user-id"]
-    )
+    user_perm = tools.permissions.get_permission_from_id(message.tags["user-id"])
 
     c.execute(
         "SELECT prefix, command FROM commands WHERE permission >= ? ORDER BY permission ASC",
-        (
-            user_perm,
-        )
+        (user_perm,),
     )
 
     fetched_commands = c.fetchall()
@@ -39,5 +35,5 @@ def main(bot: Bot, message: Message):
     for command in fetched_commands:
         commands.append(f"{command[0]}{command[1]}")
 
-    commands = ' '.join(commands)
+    commands = " ".join(commands)
     tools.smart_privmsg.send(bot, message, commands)
index 936cde6b0ba4e1b61158a9ec7f44cb7fb0d0aff6..05a8c75f7115a59be610fa4d681e7245b21855ee 100644 (file)
@@ -1,11 +1,12 @@
 from aptbot.bot import Message, Commands, Bot
 
 PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
 DESCRIPTION = "Reply to a message with \\delete to delete that message"
 USER_COOLDOWN = 0
 GLOBAL_COOLDOWN = 0
 
+
 def main(bot: Bot, message: Message):
     try:
         replied_msg_id = message.tags["reply-parent-msg-id"]
@@ -13,4 +14,3 @@ def main(bot: Bot, message: Message):
         return
     delete = f"/delete {replied_msg_id}"
     bot.send_privmsg(message.channel, delete)
-
index adee4c8f9baccad5b464477101ebfd5836208727..86a98dec1c63dca26702a25d888a2b068228d51f 100644 (file)
@@ -3,7 +3,7 @@ import sqlite3
 import os
 
 PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
 DESCRIPTION = ""
 USER_COOLDOWN = 0
 GLOBAL_COOLDOWN = 0
@@ -14,15 +14,15 @@ PATH = os.path.join(COMMANDS_PATH, "..")
 
 
 def main(bot: Bot, message: Message):
-    msg = ' '.join(message.value.split(' ')[1:])
-    command = msg.split(' ')[0]
+    msg = " ".join(message.value.split(" ")[1:])
+    command = msg.split(" ")[0]
     command_prefix = command[0]
     command_name = command[1:]
-    command_value = msg = ' '.join(msg.split(' ')[1:])
-    if command_prefix != '?':
+    command_value = msg = " ".join(msg.split(" ")[1:])
+    if command_prefix != "?":
         bot.send_privmsg(
             message.channel,
-            f"{message.nick} you cannot use {command_prefix} as a prefix"
+            f"{message.nick} you cannot use {command_prefix} as a prefix",
         )
         return
 
@@ -33,12 +33,12 @@ def main(bot: Bot, message: Message):
         (
             command_name,
             command_prefix,
-        )
+        ),
     )
     if not c.fetchone()[0]:
         bot.send_privmsg(
             message.channel,
-            f"The command {command_prefix}{command_name} cannot be edited"
+            f"The command {command_prefix}{command_name} cannot be edited",
         )
         return
 
@@ -48,17 +48,11 @@ def main(bot: Bot, message: Message):
             (
                 command_value,
                 command_name,
-            )
+            ),
         )
     except sqlite3.IntegrityError:
-        bot.send_privmsg(
-            message.channel,
-            f"The command {command_name} doesn't exist."
-        )
+        bot.send_privmsg(message.channel, f"The command {command_name} doesn't exist.")
     else:
-        bot.send_privmsg(
-            message.channel,
-            f"Successfully updated {command_name}."
-        )
+        bot.send_privmsg(message.channel, f"Successfully updated {command_name}.")
     conn.commit()
     conn.close()
index fe28f230ae0c629110b80ff3c7e061459ce2509f..fe6f8f97cce083bc466743bbdc9b784cf20c6004 100644 (file)
@@ -3,7 +3,7 @@ import tools.smart_privmsg
 import urllib3
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 90
 GLOBAL_COOLDOWN = 60
@@ -25,7 +25,7 @@ def main(bot: Bot, message: Message):
             message.channel,
             "NotLikeThis oopsie woopsie, we've made a fucky wucky. We can't \
             get the emotes at the moment. Hopefuwwy UwU wiww wait patientwy \
-            tiww we get thiws pwobwem sowted. OwO"
+            tiww we get thiws pwobwem sowted. OwO",
         )
         return
     emotes = r1.data.decode("utf-8")
index 9427a122698b03fc0c59b082cbc59ec64d499568..6e7d2639c30241667540b51f17e3a4d0f4b043f7 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import time
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 062b6fef08b199cc2194c1e81f07f6bc5d0a5540..950138f81d33d86bea2a4ddea23fd2698dc9d8c2 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 2ea5fcb875fb56d59620fda85ab9859549897b29..4ae7874d658b6365eb8d988340827d02b103c4cc 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 1b355d1f735fbab3897d09fa11e64fea28be7e88..68edb695e5ac2bb2afea404e4ba343bb5a54a307 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import time
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index d64f6e3fa754daa91588f9b54d04185ab0997a75..31ceb1ab0aa33980ab8ace3f3a932217662eb06f 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import time
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index badb0d743b0156a5b1bbf7ad2cb3288dafc8c2d8..77ff305c092b199c15360e6d253e4bc8042883ce 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index 7cfa1aebd7edfd603c0114a63bc292f4f94deb7e..7eae2040ca4e0393a5473c0e2efb3923598052b9 100644 (file)
@@ -4,19 +4,22 @@ from datetime import datetime
 import datetime as dt
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 15
 GLOBAL_COOLDOWN = 5
 
 STREAM_SCHEDULE = dt.time(17, 30)
 
+
 def main(bot: Bot, message: Message):
     start_stream_ts = tools.smart_start_stream_time.start_stream_timestamp()
     if not start_stream_ts:
         return
     start_stream_dt = datetime.utcfromtimestamp(start_stream_ts)
-    stream_schedule_dt = datetime.combine(datetime.utcfromtimestamp(start_stream_ts), STREAM_SCHEDULE)
+    stream_schedule_dt = datetime.combine(
+        datetime.utcfromtimestamp(start_stream_ts), STREAM_SCHEDULE
+    )
     latege_amount = (start_stream_dt - stream_schedule_dt).total_seconds()
     if latege_amount > 45 * 60:
         msg = f"{message.channel} is so Latege he might as well have not \
@@ -30,4 +33,3 @@ def main(bot: Bot, message: Message):
         msg = f"UNBELIEVABLE!!!!! {message.channel} is EARLY by {-latege_amount} seconds!!!!\
         This has NEVER happened before POGGERS"
     bot.send_privmsg(message.channel, msg)
-
index 6de248ca5a8ac239be68177f09d5fe1f19b505e1..5cfcd32f27d06524ffad39b7f5ddb52d9ed3b04b 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index f6deda761c2a7176ecd32562c75a0b765bcf4d7c..b6d8f711db64dcbec45012c891e9bddc26135f76 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 83637873ed4ad6a0fce18dcf4693d1ef2665afed..5c062c79d0f6abd7fd4c94dcf4f1b699d29ddad2 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 7c449088c17e38ae99958111f5ac5cf30571f508..cf70770c3ef7069d7045e0b7ffee8eceab37e726 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import random
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 9a2fb158b0755e47b31cf77b5c6544b3108c5ee2..2aca550a489556575cdc719b1b54554d478fc8d2 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import time
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index d403e8e98e1bab6e973d01182bfc05ded760c7da..420a0d081cf8507136a6588ae3d7f19a79ccfbfc 100644 (file)
@@ -8,15 +8,6 @@ import ttv_api.users
 from tools import smart_privmsg
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 PERMISSION = 99
index 6d8cfd979e343b57e3fd231b07d5af4602ce7aca..a42e916f364612f8fddd76dae60005503f84ea95 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import tools.smart_privmsg
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index 4af03a95704388e35cba22ba51c9ed1dbb2997d8..671e49a2e6133908c67387a8189e1dbb0fea7f9f 100644 (file)
@@ -3,7 +3,7 @@ import sqlite3
 import os
 
 PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
 DESCRIPTION = ""
 USER_COOLDOWN = 0
 GLOBAL_COOLDOWN = 0
@@ -13,19 +13,14 @@ PATH = os.path.join(COMMANDS_PATH, "..")
 
 
 def main(bot: Bot, message: Message):
-    msg = ' '.join(message.value.split(' ')[1:])
-    command = msg.split(' ')[0]
+    msg = " ".join(message.value.split(" ")[1:])
+    command = msg.split(" ")[0]
     command_prefix = command[0]
     command_name = command[1:]
 
     conn = sqlite3.connect(os.path.join(PATH, "database.db"))
     c = conn.cursor()
-    c.execute(
-        "SELECT value FROM command_values WHERE command = ?",
-        (
-            command_name,
-        )
-    )
+    c.execute("SELECT value FROM command_values WHERE command = ?", (command_name,))
     command_path = os.path.join(COMMANDS_PATH, f"{command_name}.py")
     hidden_command_path = os.path.join(COMMANDS_PATH, f".{command_name}.py")
     try:
@@ -43,17 +38,11 @@ def main(bot: Bot, message: Message):
             (
                 command_name,
                 command_prefix,
-            )
+            ),
         )
     except sqlite3.IntegrityError:
-        bot.send_privmsg(
-            message.channel,
-            f"The command {command_name} doesn't exist."
-        )
+        bot.send_privmsg(message.channel, f"The command {command_name} doesn't exist.")
     else:
-        bot.send_privmsg(
-            message.channel,
-            f"Successfully removed {command_name}."
-        )
+        bot.send_privmsg(message.channel, f"Successfully removed {command_name}.")
     conn.commit()
     conn.close()
index b983db44d92469951cc0e979d6b1c7a36134ff72..3b3a0f0e2d3d0b97eca9a6f0ed893eafb437e4e4 100644 (file)
@@ -1,7 +1,7 @@
 from aptbot.bot import Message, Commands, Bot
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 10
 GLOBAL_COOLDOWN = 10
index 571a38f4494ddbc87242393f9ab044ab4d3f3d64..5db59e0cedfdcb396e47bd335c755ae56e24c631 100644 (file)
@@ -2,7 +2,7 @@ from aptbot.bot import Message, Commands, Bot
 import tools.smart_privmsg
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 30
 GLOBAL_COOLDOWN = 15
@@ -18,7 +18,7 @@ def main(bot: Bot, message: Message):
     if replied_message:
         msg = replied_message
     else:
-        msg = ' '.join(message.value.split(' ')[1:])
+        msg = " ".join(message.value.split(" ")[1:])
     new_msg = ""
     while len(new_msg) + len(msg) < MAX_LENGTH:
         new_msg += msg + " "
index 337f1fa6e7e807533e0e88dbdd8c30c993a0e209..9c84b7a1052be3e358679abc005e473f18178376 100644 (file)
@@ -3,7 +3,7 @@ import tools.smart_privmsg
 import scripts.translator
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = "Translates a message from any language (supported by google translate) into English. How to use: ?t <insert text to translate>"
 USER_COOLDOWN = 15
 GLOBAL_COOLDOWN = 5
@@ -15,7 +15,7 @@ def main(bot: Bot, message: Message):
         msg = replied_message
         replied_msg_id = message.tags["reply-parent-msg-id"]
     else:
-        msg = ' '.join(message.value.split(' ')[1:])
+        msg = " ".join(message.value.split(" ")[1:])
         replied_msg_id = None
     trans = scripts.translator.translate(msg)
     print(trans)
index fc90363a2788bafa478b3873b76d63688bd87573..b7779344970843a4210796fbbb49bd4e6f581750 100644 (file)
@@ -6,15 +6,6 @@ import sqlite3
 import tools.smart_privmsg
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 99
 PREFIX = "?"
index 02f7535e563fd3ccbc4395cf564ba79278a34c17..f50277e6d071f6b07d16ee7c0c5fd2a4e55c7cb4 100644 (file)
@@ -4,15 +4,6 @@ import logging
 import sqlite3
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PERMISSION = 10
 PREFIX = "\\"
index 0f1e5fed203d964f8c872e9a38fd327d60cb908f..bf1fdb6e9595ac455baf858f08e417a6ddb31479 100644 (file)
@@ -4,19 +4,10 @@ import logging
 from tools import smart_privmsg
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = ""
 USER_COOLDOWN = 0
 GLOBAL_COOLDOWN = 0
@@ -27,13 +18,24 @@ PATH = os.path.join(PATH, "..")
 
 def main(bot: Bot, message: Message):
     if message.tags.get("reply-parent-display-name", None):
-        smart_privmsg.send(bot, message, f"{message.tags['reply-parent-display-name']}, {message.nick} is UwUing you. Will you UwU back? PauseChamp", reply=message.tags['reply-parent-msg-id'])
+        smart_privmsg.send(
+            bot,
+            message,
+            f"{message.tags['reply-parent-display-name']}, {message.nick} is UwUing you. Will you UwU back? PauseChamp",
+            reply=message.tags["reply-parent-msg-id"],
+        )
         return
     try:
-        user = message.value.split(' ')[1]
+        user = message.value.split(" ")[1]
     except IndexError:
-        smart_privmsg.send(bot, message, f"UwU to you too {message.nick}!", reply=message.tags["id"])
+        smart_privmsg.send(
+            bot, message, f"UwU to you too {message.nick}!", reply=message.tags["id"]
+        )
         return
     else:
-        smart_privmsg.send(bot, message, f"{user}, {message.nick} is UwUing you. Will you UwU back? PauseChamp")
+        smart_privmsg.send(
+            bot,
+            message,
+            f"{user}, {message.nick} is UwUing you. Will you UwU back? PauseChamp",
+        )
         return
index afe4a6ca5197c0b2b38c9ae7e8887fc21afbf7fe..b3965d2f510011da8215e4b8f92912c04ef20f99 100644 (file)
@@ -2,7 +2,7 @@ from aptbot.bot import Message, Commands, Bot
 import yt_api.videos
 
 PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
 DESCRIPTION = "Get my newest video! Just type ?video"
 USER_COOLDOWN = 15
 GLOBAL_COOLDOWN = 15
@@ -14,7 +14,7 @@ def main(bot: Bot, message: Message):
     video = yt_api.videos.get_newest_video(CHANNEL_ID)
     if video:
         video_link = f"https://www.youtube.com/watch?v={video.video_id}"
-        msg = f"Watch Peks' latest video \"{video.video_name}\" here: {video_link}"
+        msg = f'Watch Peks\' latest video "{video.video_name}" here: {video_link}'
     else:
         msg = f"Check out my youtube channel here -> https://www.youtube.com/channel/{CHANNEL_ID}"
     bot.send_privmsg(message.channel, msg)
index 7f079bf13da0be8fba1ac8c41e34195b3d1fb022..92a833355eb653b72b15dae8b55d0d492af97270 100644 (file)
@@ -5,15 +5,6 @@ import ttv_api.users
 import logging
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PATH = os.path.dirname(os.path.realpath(__file__))
 logger.debug(f"PATH set to: {PATH}")
@@ -25,7 +16,7 @@ logger.debug(f"streamer_login set to: {streamer_login}")
 
 
 def create_variables_db():
-    db_name_var = "variables.db" 
+    db_name_var = "variables.db"
     conn = sqlite3.connect(os.path.join(PATH, db_name_var))
     c = conn.cursor()
     logger.info(f"connected to database {db_name_var}")
@@ -71,6 +62,7 @@ def create_variables_db():
     conn.commit()
     conn.close()
 
+
 def create_lol_database():
     db_name_database = "lol_data.db"
     conn = sqlite3.connect(os.path.join(PATH, db_name_database))
@@ -120,6 +112,7 @@ def create_lol_database():
     conn.commit()
     conn.close()
 
+
 def create_database():
     db_name_database = "database.db"
     conn = sqlite3.connect(os.path.join(PATH, db_name_database))
@@ -157,16 +150,17 @@ def create_database():
     aptbot_id = ttv_api.users.get_users(user_logins=["murphyai"])
     broadcaster_id = ttv_api.users.get_users(user_logins=[streamer_login])
     if admin_id:
-        c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
-                  (admin_id[0].user_id, 0))
+        c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)", (admin_id[0].user_id, 0))
         logger.info(f"inserted user {admin_id[0].user_id} with permission {0}")
     if aptbot_id:
-        c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
-                  (aptbot_id[0].user_id, 0))
+        c.execute(
+            "INSERT OR IGNORE INTO users VALUES (?, ?)", (aptbot_id[0].user_id, 0)
+        )
         logger.info(f"inserted user {aptbot_id[0].user_id} with permission {0}")
     if broadcaster_id:
-        c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
-                  (broadcaster_id[0].user_id, 1))
+        c.execute(
+            "INSERT OR IGNORE INTO users VALUES (?, ?)", (broadcaster_id[0].user_id, 1)
+        )
         logger.info(f"inserted user {broadcaster_id[0].user_id} with permission {1}")
 
     c.execute(
@@ -241,7 +235,7 @@ def update_commands_in_database(modules, commands):
     logger.info(f"connected to database {db_name_database}")
 
     for command in commands:
-        command_name = command.split('.')[0]
+        command_name = command.split(".")[0]
         command_permission = modules[command_name].PERMISSION
         command_prefix = modules[command_name].PREFIX
         command_description = modules[command_name].DESCRIPTION
@@ -258,18 +252,23 @@ def update_commands_in_database(modules, commands):
                 command_user_cooldown,
                 command_global_cooldown,
                 command_last_used,
-            )
+            ),
         )
         logger.info(f"updating commands command_name: {command_name}")
         logger.debug(f"updating commands command_prefix: {command_prefix}")
         logger.debug(f"updating commands command_permission: {command_permission}")
         logger.debug(f"updating commands command_description: {command_description}")
-        logger.debug(f"updating commands command_user_cooldown: {command_user_cooldown}")
-        logger.debug(f"updating commands command_global_cooldown: {command_global_cooldown}")
+        logger.debug(
+            f"updating commands command_user_cooldown: {command_user_cooldown}"
+        )
+        logger.debug(
+            f"updating commands command_global_cooldown: {command_global_cooldown}"
+        )
         logger.debug(f"updating commands command_last_used: {command_last_used}")
     conn.commit()
     conn.close()
 
+
 def add_message_to_chat_history(message: Message):
     if message.command != Commands.PRIVMSG:
         return
@@ -284,7 +283,7 @@ def add_message_to_chat_history(message: Message):
         rp_display_name = message.tags["reply-parent-display-name"]
         rp_msg_body = message.tags["reply-parent-msg-body"]
         rp_msg_id = message.tags["reply-parent-msg-id"]
-        rp_user_id = int( message.tags["reply-parent-user-id"] )
+        rp_user_id = int(message.tags["reply-parent-user-id"])
         rp_user_login = message.tags["reply-parent-user-login"]
     except KeyError:
         rp_display_name = None
@@ -332,22 +331,23 @@ def add_message_to_chat_history(message: Message):
             message.tags["color"],
             message.tags["display-name"],
             int(message.tags["first-msg"]),
-            int( message.tags["mod"] ),
-            int( message.tags["room-id"] ),
-            int( message.tags["user-id"] ),
+            int(message.tags["mod"]),
+            int(message.tags["room-id"]),
+            int(message.tags["user-id"]),
             message.tags["user-type"],
-            int( message.tags["turbo"] ),
-            int( message.tags["subscriber"] ),
+            int(message.tags["turbo"]),
+            int(message.tags["subscriber"]),
             rp_display_name,
             rp_msg_body,
             rp_msg_id,
             rp_user_id,
             rp_user_login,
-        )
+        ),
     )
     conn.commit()
     conn.close()
 
+
 def create_chat_history_database():
     conn = sqlite3.connect(os.path.join(PATH, "chat_history.db"))
     c = conn.cursor()
@@ -390,7 +390,7 @@ def update_auto_messages_in_database(modules, auto_messages):
     c = conn.cursor()
 
     for auto_message in auto_messages:
-        auto_message_name = auto_message.split('.')[0]
+        auto_message_name = auto_message.split(".")[0]
         auto_message_cooldown = modules[auto_message_name].COOLDOWN
         auto_message_end_time = modules[auto_message_name].END_TIME
         auto_message_last_used = 0
@@ -402,7 +402,7 @@ def update_auto_messages_in_database(modules, auto_messages):
                     auto_message_cooldown,
                     auto_message_end_time,
                     auto_message_last_used,
-                )
+                ),
             )
         except Exception as e:
             c.execute(
@@ -418,7 +418,7 @@ def update_auto_messages_in_database(modules, auto_messages):
                     auto_message_cooldown,
                     auto_message_end_time,
                     auto_message_name,
-                )
+                ),
             )
     conn.commit()
     conn.close()
index 5341c9fbeaba809ab707bca11004d7568213ab60..197bf0b8c98148eb8a97477fa2e809f46066f2c7 100644 (file)
@@ -1,14 +1,3 @@
 from lol_api import *
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
-
-
index 3c2a69226dc4c29d7fcb61582771cda8ce73f3f3..c678236720dac0004829ac450188d3da0fc02dc6 100644 (file)
@@ -2,15 +2,6 @@ from lol_api import *
 from typing import Optional
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 @dataclass
index fbb48401dc556340f5318bac110dbdf808875f85..c234b9e1a778cc7aae947f674c10a4f3df091ce4 100644 (file)
@@ -1,15 +1,6 @@
 from lol_api import *
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 @dataclass
@@ -22,6 +13,7 @@ class Summoner:
     revision_date: int
     summoner_level: int
 
+
 def get_summoner_from_puuid(puuid: str) -> Optional[Summoner]:
     endpoint = f"/lol/summoner/v4/summoners/by-puuid/{puuid}"
     url = BASE_URL + endpoint
@@ -33,7 +25,9 @@ def get_summoner_from_puuid(puuid: str) -> Optional[Summoner]:
         headers=HEADER,
     )
     if r.status != 200:
-        logger.warning(f"Couldn't retrieve summoner with puuid: {puuid}. Status code {r.status}")
+        logger.warning(
+            f"Couldn't retrieve summoner with puuid: {puuid}. Status code {r.status}"
+        )
         return None
     data = json.loads(r.data.decode("utf-8"))
     return Summoner(
@@ -43,7 +37,7 @@ def get_summoner_from_puuid(puuid: str) -> Optional[Summoner]:
         data["name"],
         data["profileIconId"],
         data["revisionDate"],
-        data["summonerLevel"]
+        data["summonerLevel"],
     )
 
 
@@ -68,6 +62,5 @@ def get_summoner_from_name(name: str) -> Optional[Summoner]:
         data["name"],
         data["profileIconId"],
         data["revisionDate"],
-        data["summonerLevel"]
+        data["summonerLevel"],
     )
-
index 68d8bb5ce3ccb6f83299cf5c6e1a7be9f6bfaf67..1c2dd35c7a66fa29a87fffceb4d28d9db17f2dec 100644 (file)
@@ -29,15 +29,6 @@ reload(database_manager)
 reload(analyze_auto_message)
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 PATH = os.path.dirname(os.path.realpath(__file__))
 logger.info(f"PATH set to: {PATH}")
@@ -120,7 +111,9 @@ def start(bot: Bot, message: Message):
         i += wait
         started = tools.smart_start_stream_time.update_start_stream_timestamp()
         if started == "START":
-            bot.send_privmsg(message.channel, "Stream has started, you can now use ?join")
+            bot.send_privmsg(
+                message.channel, "Stream has started, you can now use ?join"
+            )
         elif started == "END":
             bot.send_privmsg(message.channel, "Stream has ended")
         if i >= 30:
index 0c43470da5a7bdec61b756f70f20624bb5a7c7dd..bbabe659b7c875a15f0008683fe2014cd1a32456 100644 (file)
@@ -1,34 +1,45 @@
-beautifulsoup4==4.10.0
+beautifulsoup4==4.11.1
+black==22.3.0
 blis==0.7.7
 catalogue==2.0.7
-certifi==2021.10.8
+certifi==2022.5.18.1
 charset-normalizer==2.0.12
-click==8.0.4
+click==8.1.3
 cymem==2.0.6
-deep-translator==1.8.1
-en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0-py3-none-any.whl
+deep-translator==1.8.3
+en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.3.0/en_core_web_sm-3.3.0-py3-none-any.whl
+flake8==4.0.1
+flake8-black==0.3.3
 idna==3.3
-Jinja2==3.1.1
+Jinja2==3.1.2
 langcodes==3.3.0
 MarkupSafe==2.1.1
-murmurhash==1.0.6
-numpy==1.22.3
+mccabe==0.6.1
+murmurhash==1.0.7
+mypy-extensions==0.4.3
+numpy==1.22.4
 packaging==21.3
+pathspec==0.9.0
 pathy==0.6.1
+platformdirs==2.5.2
 preshed==3.0.6
+pycodestyle==2.8.0
 pydantic==1.8.2
-pyparsing==3.0.7
+pyflakes==2.4.0
+pyparsing==3.0.9
 python-dotenv==0.20.0
 requests==2.27.1
 smart-open==5.2.1
-soupsieve==2.3.1
-spacy==3.2.4
+soupsieve==2.3.2.post1
+spacy==3.3.0
 spacy-legacy==3.0.9
 spacy-loggers==1.0.2
-srsly==2.4.2
-thinc==8.0.15
-tqdm==4.63.1
-typer==0.4.0
-typing-extensions==4.1.1
+srsly==2.4.3
+thinc==8.0.16
+tomli==2.0.1
+tqdm==4.64.0
+typer==0.4.1
+typing-extensions==4.2.0
 urllib3==1.26.9
 wasabi==0.9.1
+websocket-client==1.3.2
index b538bdbe4785d15644d637c88e0b1bc11ab4af82..b44597c687a1ea2d17fd25298646a3987cacf55c 100644 (file)
@@ -2,6 +2,7 @@ from aptbot.bot import Bot, Message, Commands
 import tools.smart_privmsg
 import random
 
+
 def alwase(bot: Bot, message: Message):
     if "always" not in message.value.lower():
         return
@@ -9,6 +10,10 @@ def alwase(bot: Bot, message: Message):
         replied_msg_id = message.tags["id"]
     except KeyError:
         replied_msg_id = None
-    msgs = ["It's alwase Madge", "Why don't you spell it alwase? Madge", "Spell it alwase or peepoArriveBan"]
+    msgs = [
+        "It's alwase Madge",
+        "Why don't you spell it alwase? Madge",
+        "Spell it alwase or peepoArriveBan",
+    ]
     msg = random.choice(msgs)
     tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)
index 5d79de315748f33363626b89b0e2575057328c49..104094ee81a253e6189704c0f81df70bffe5693a 100644 (file)
@@ -10,10 +10,10 @@ def chatting(bot: Bot, message: Message):
         return
     msg = ""
     if "reply-parent-msg-body" in message.tags:
-        if message.value.split(' ')[1] == "Chatting":
-            msg = ' '.join(message.value.split(' ')[1:])
+        if message.value.split(" ")[1] == "Chatting":
+            msg = " ".join(message.value.split(" ")[1:])
     else:
-        if message.value.split(' ')[0] == "Chatting":
+        if message.value.split(" ")[0] == "Chatting":
             msg = message.value
     if msg:
         tools.smart_privmsg.send(bot, message, msg)
index 9bf9d43c61c277a7e6f61e5d52425e06cd8a6db8..635b2b97efb366cc56ce27adf407618e3c5285e9 100644 (file)
@@ -11,15 +11,6 @@ STREAMER_PATH = os.path.abspath(os.path.join(__file__, "../.."))
 streamer_login = os.path.split(STREAMER_PATH)[1]
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 
 def clean_queue():
index 32382cda43ec624e81b6fc0e27d05355105e689d..f9fb532ffb347e49bf751b7fcae8ce7cf4701500 100644 (file)
@@ -35,12 +35,12 @@ def _tometric(text: str) -> tuple[list[tuple[int, int]], list[float]]:
     found_single = False
     for w in doc:
         # print(w.text, w.pos_)
-        if w.pos_ in {'AUX', 'VERB', 'ADP'}:
+        if w.pos_ in {"AUX", "VERB", "ADP"}:
             if feet_was_last and not next_should_be_double:
                 ft_inch.append((feet, 0.0))
                 feet = 0
                 inches = 0
-        if w.like_num or w.pos_ == 'NUM':
+        if w.like_num or w.pos_ == "NUM":
             # index_of_previous_token = w.i - 1
             # try:
             #     prev_token = doc[index_of_previous_token]
@@ -70,11 +70,11 @@ def _tometric(text: str) -> tuple[list[tuple[int, int]], list[float]]:
                         ft_inch.append((feet, 0.0))
                     feet = float(w.text)
                     feet_was_last = True
-                elif next_token.lemma_ in {"inch", "\""}:
-                    if next_token.lemma_ == "\"" and next_should_be_double:
+                elif next_token.lemma_ in {"inch", '"'}:
+                    if next_token.lemma_ == '"' and next_should_be_double:
                         inches = float(w.text)
                         next_should_be_double = False
-                    elif next_token.lemma_ == "\"":
+                    elif next_token.lemma_ == '"':
                         inches = 0
                     elif next_should_be_double:
                         feet = 0
index 6ffa8ffdec3e2941d10286cfd66cebd7e56f31c3..dc8a7293dc4766d8272cdad0cac2b69ff645225c 100644 (file)
@@ -9,15 +9,6 @@ from scripts import clean_queue
 from typing import Optional
 
 logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
 
 STREAMER_PATH = os.path.abspath(os.path.join(__file__, "../.."))
 logger.debug(f"STREAMER_PATH set to: {STREAMER_PATH}")
@@ -100,7 +91,7 @@ def update_start_stream_timestamp() -> Optional[str]:
         if time.time() < last_checked + CHECK_STREAMTIME_CD:
             logger.info(f"returned cached start stream time: {start_stream_ts}")
             conn.close()
-            return 
+            return
 
     stream_info = ttv_api.stream.get_streams(user_logins=[streamer_login])
     logger.info(f"used twitch api to get stream info")
@@ -172,4 +163,4 @@ def update_start_stream_timestamp() -> Optional[str]:
     )
     conn.close()
     logger.info(f"returned cached start stream time: {start_stream_ts}")
-    return 
+    return
index 9bf30444b6c589dfbd5c356dd2fa4de0349898ed..52c3b53ddc4752c9f4b84150ef81db4f5b6b93fd 100644 (file)
@@ -31,11 +31,7 @@ class Expression:
                     AND list_values.id = ?
                     AND methods.name = ?
                 """,
-                (
-                    self.name,
-                    self.list_id,
-                    self.method
-                )
+                (self.name, self.list_id, self.method),
             )
         conn.close()
         pass
index 9c68f72c955db46f97e6bd12cfa6aa51416c94fa..d0e9fc203ac0a13e9472db866fc14cc53bc02cb5 100644 (file)
@@ -10,8 +10,12 @@ class Video:
 
 def get_newest_video(channel_id: str) -> Optional[Video]:
     get_video_snippets = "?part=snippet"
-    get_url = URL + get_video_snippets + \
-        f"&channelId={channel_id}&order=date&type=video" + f"&key={API}"
+    get_url = (
+        URL
+        + get_video_snippets
+        + f"&channelId={channel_id}&order=date&type=video"
+        + f"&key={API}"
+    )
 
     http = urllib3.PoolManager()
     r = http.request(