From 6a92ff4956be3759cd8b4663c2d1c8debd2da927 Mon Sep 17 00:00:00 2001 From: Migatu Date: Thu, 22 Jun 2023 23:25:30 +0200 Subject: [PATCH] Small fixes continued. --- bot.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/bot.py b/bot.py index 1b64227..5a6f193 100644 --- a/bot.py +++ b/bot.py @@ -42,9 +42,6 @@ import yt_dlp from spotify_dl import spotify from spotify_dl import youtube as youtube_download -Movie = TypedDict("Movie", {"name": str, "year": int}) -movie: Movie = {"name": "Blade Runner", "year": 1982} - Music_Config = TypedDict( "Music_Config", { @@ -57,7 +54,7 @@ Music_Config = TypedDict( # *=========================================== Predefines formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -master_timeout = datetime.now() +MASTER_TIMEOUT = datetime.now() INITIAL_TIME_WAIT = 5 MUZYKA: Music_Config = {"playing": False, "ctx": None, "queue": [], "requestor": []} @@ -70,7 +67,9 @@ SETTINGS_FILE = "" ENCODING = "" GRAPHICS_PATH = "" # *=========================================== Platform Specific Predefines + if platform in ("linux", "linux2"): + SEPARATOR_FILE_PATH = "/" if "microsoft-standard" in uname().release: LOGFILE = "/home/mtuszowski/conjurer/discord.log" MEMORY_FIVE_SIARA = "/home/mtuszowski/conjurer/pamiec.json" @@ -109,6 +108,7 @@ elif platform == "win32": ACCIDENT_LOG = "accident_log.json" ENCODING = "utf-8" DIR_PATH_SADOX = "C:\\Users\\mtusz\\OneDrive\\Dokumenty\\Fansadox\\" + SEPARATOR_FILE_PATH = "\\" # *=========================================== Keys @@ -237,7 +237,7 @@ async def on_message(message): # TODO: wpiac jego reakcje we framework chatu GPT message.content = message.content.lower() - tdelta = datetime.now() - master_timeout + tdelta = datetime.now() - MASTER_TIMEOUT tdelta = tdelta.total_seconds() if "opowiedz o fabryczce" in message.content: await message.reply(historia_fabryczki) @@ -400,12 +400,7 @@ async def play(ctx, zamawial=None, arg=None): logger.debug(file_to_play) metadata = eyed3.load(file_to_play) query = None - separator = None - if platform in ("linux", "linux2"): - separator = "/" - elif platform == "win32": - separator = "\\" - temp = file_to_play.split(separator)[-1] + temp = file_to_play.split(SEPARATOR_FILE_PATH)[-1] kawalek = f"Zagram teraz kawalek {temp} z prywatnej kolekcji Hammera." if metadata: if metadata.tag: