adding a hacky line to parse room names if they are defined as their full muc address... (debugging the @folder feature)

This commit is contained in:
manetta 2021-05-06 22:36:02 +02:00
parent 433ee3f066
commit 75cac06439

View File

@ -165,7 +165,7 @@ class Logbot(Bot):
if "stylesheet" not in self.db[room]: if "stylesheet" not in self.db[room]:
self.db[room]["stylesheet"] = "timeline" # default stylesheet self.db[room]["stylesheet"] = "timeline" # default stylesheet
if "font" not in self.db[room]: if "font" not in self.db[room]:
self.db[room]["font"] = 'None' # default font self.db[room]["font"] = 'none' # default font
self.db._dumps() self.db._dumps()
self.log.info(f"Added to the database: { room }") self.log.info(f"Added to the database: { room }")
@ -240,6 +240,8 @@ class Logbot(Bot):
match = re.findall("@folder .*", message.content)[0] match = re.findall("@folder .*", message.content)[0]
newfoldername = match.replace("@folder ", "") newfoldername = match.replace("@folder ", "")
currentfoldername = self.db[message.room]["folder"] currentfoldername = self.db[message.room]["folder"]
if "@" in currentfoldername: # hacky
currentfoldername = self._parse_room_name(currentfoldername)
os.rename(currentfoldername, newfoldername) os.rename(currentfoldername, newfoldername)
self.db[message.room]["folder"] = 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}" reply = f"The foldername of the log is changed to: { newfoldername }. The URL of the log changed into: https://vvvvvvaria.org/logs/{ newfoldername}"