From ef58cd2f182560f956f2693722c325d4cf29018c Mon Sep 17 00:00:00 2001 From: manetta Date: Thu, 6 May 2021 22:40:37 +0200 Subject: [PATCH] adding full paths to foldernames --- LogBot/logbot.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index 9554d19..eb56642 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -238,13 +238,15 @@ class Logbot(Bot): # https://git.vvvvvvaria.org/varia/bots/issues/5 elif "@folder" in message.text: match = re.findall("@folder .*", message.content)[0] - newfoldername = match.replace("@folder ", "") - currentfoldername = self.db[message.room]["folder"] - if "@" in currentfoldername: # hacky - currentfoldername = self._parse_room_name(currentfoldername) - os.rename(currentfoldername, newfoldername) - self.db[message.room]["folder"] = newfoldername - reply = f"The foldername of the log is changed to: { newfoldername }. The URL of the log changed into: https://vvvvvvaria.org/logs/{ newfoldername}" + new_folder_name = match.replace("@folder ", "") + current_folder_name = self.db[message.room]["folder"] + if "@" in current_folder_name: # hacky + current_folder_name = self._parse_room_name(current_folder_name) + current_folder_name_path = os.path.join(self.output, current_folder_name) + new_folder_name_path = os.path.join(self.output, new_folder_name) + os.rename(current_folder_name_path, new_folder_name_path) + self.db[message.room]["folder"] = new_folder_name + reply = f"The foldername of the log is changed to: { new_folder_name }. The URL of the log changed into: https://vvvvvvaria.org/logs/{ new_folder_name}" # Response to @style elif "@style" in message.text: