|
|
@ -129,29 +129,38 @@ logbot @uptime: To check how long @logbot has been around |
|
|
|
@bots: To see who is around :) |
|
|
|
""" |
|
|
|
|
|
|
|
def setup(self): |
|
|
|
self.log.info(f"Output folder is set to: { self.output }") |
|
|
|
|
|
|
|
for room in self.rooms: |
|
|
|
|
|
|
|
roomname = str(re.match(r".*@", room).group()).replace("@", "") |
|
|
|
room_path = os.path.join(self.output, roomname) |
|
|
|
def _parse_room_name(self, room): |
|
|
|
"""Parse room name from entire address string.""" |
|
|
|
return str(re.match(r".*@", room).group()).replace("@", "") |
|
|
|
|
|
|
|
def _setup_room(self, room): |
|
|
|
"""Create directories and database entries for a new room.""" |
|
|
|
room_name = self._parse_room_name(room) |
|
|
|
room_path = os.path.join(self.output, room_name) |
|
|
|
self.log.info(f"Processing setup logic for: {room_path}") |
|
|
|
|
|
|
|
# Check if the room is in the database already |
|
|
|
if not room in self.db.keys(): |
|
|
|
if room not in self.db.keys(): |
|
|
|
self.db[room] = {} |
|
|
|
self.db[room]["messages"] = {} |
|
|
|
self.db[room]["title"] = room |
|
|
|
self.log.info(f"Added to the database: { room }") |
|
|
|
|
|
|
|
# Check if the room has an output folder already |
|
|
|
if not os.path.exists(room_path): |
|
|
|
os.mkdir(room_path) |
|
|
|
shutil.copy("stylesheet.css", room_path) |
|
|
|
self.log.info(f"Created a folder for: { room }") |
|
|
|
self.log.info(f"Copied stylesheet.css to: { room }") |
|
|
|
|
|
|
|
def setup(self): |
|
|
|
self.log.info(f"Output folder is set to: { self.output }") |
|
|
|
for room in self.rooms: |
|
|
|
self._setup_room(room) |
|
|
|
|
|
|
|
def group_invite(self, message): |
|
|
|
"""Extend xbotlib invite response logic and do required room setup.""" |
|
|
|
super().group_invite(message) |
|
|
|
self._setup_room(message.room) |
|
|
|
|
|
|
|
def group(self, message): |
|
|
|
|
|
|
|
# to debug in the terminal |
|
|
|