adding full paths to foldernames

This commit is contained in:
manetta 2021-05-06 22:40:37 +02:00
parent 75cac06439
commit ef58cd2f18

View File

@ -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: