Browse Source

updating room_path to folder_name_path for updating stylesheets and fonts too

master
manetta 4 years ago
parent
commit
9a02566c62
  1. 13
      LogBot/logbot.py

13
LogBot/logbot.py

@ -244,9 +244,12 @@ class Logbot(Bot):
current_folder_name = self._parse_room_name(current_folder_name) current_folder_name = self._parse_room_name(current_folder_name)
current_folder_name_path = os.path.join(self.output, 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) new_folder_name_path = os.path.join(self.output, new_folder_name)
os.rename(current_folder_name_path, new_folder_name_path) try:
self.db[message.room]["folder"] = new_folder_name os.rename(current_folder_name_path, new_folder_name_path)
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}" 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 # Response to @style
elif "@style" in message.text: elif "@style" in message.text:
@ -255,7 +258,7 @@ class Logbot(Bot):
stylesheet = stylesheet.lower() stylesheet = stylesheet.lower()
self.db[message.room]["stylesheet"] = stylesheet self.db[message.room]["stylesheet"] = stylesheet
room_name = self._parse_room_name(message.room) 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_path = os.path.join("stylesheets", f"{ stylesheet }.css")
stylesheet_dest_path = os.path.join(room_path, "stylesheet.css") stylesheet_dest_path = os.path.join(room_path, "stylesheet.css")
try: try:
@ -272,7 +275,7 @@ class Logbot(Bot):
font = font.lower() font = font.lower()
self.db[message.room]["font"] = font self.db[message.room]["font"] = font
room_name = self._parse_room_name(message.room) 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_path = os.path.join("fonts", f"{ font }.ttf")
font_dest_path = os.path.join(room_path, "font.ttf") font_dest_path = os.path.join(room_path, "font.ttf")
if font == 'none': if font == 'none':

Loading…
Cancel
Save