From 9a02566c626f51a52ae1b7e49b4221a7731f5e6c Mon Sep 17 00:00:00 2001 From: manetta Date: Thu, 6 May 2021 22:48:54 +0200 Subject: [PATCH] updating room_path to folder_name_path for updating stylesheets and fonts too --- LogBot/logbot.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index eb56642..22b952c 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -244,9 +244,12 @@ class Logbot(Bot): 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}" + try: + 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}" + except: + reply = f"Sorry i couldn\'t shange that foldername into: '{ new_folder_name }'. Try again with: 'logbot @folder newname'." # Response to @style elif "@style" in message.text: @@ -255,7 +258,7 @@ class Logbot(Bot): stylesheet = stylesheet.lower() self.db[message.room]["stylesheet"] = stylesheet room_name = self._parse_room_name(message.room) - room_path = os.path.join(self.output, room_name) + room_path = os.path.join(self.output, self.db[message.room]["folder"]) stylesheet_path = os.path.join("stylesheets", f"{ stylesheet }.css") stylesheet_dest_path = os.path.join(room_path, "stylesheet.css") try: @@ -272,7 +275,7 @@ class Logbot(Bot): font = font.lower() self.db[message.room]["font"] = font room_name = self._parse_room_name(message.room) - room_path = os.path.join(self.output, room_name) + room_path = os.path.join(self.output, self.db[message.room]["folder"]) font_path = os.path.join("fonts", f"{ font }.ttf") font_dest_path = os.path.join(room_path, "font.ttf") if font == 'none':