Fixed log command
This commit is contained in:
		@@ -44,7 +44,7 @@ class LogCommand(DiscordCommandABC):
 | 
				
			|||||||
        self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
 | 
					        self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _reduce_path(self, p: str) -> str:
 | 
					    def _reduce_path(self, p: str) -> str:
 | 
				
			||||||
        if p.count('/') == 1 or p == '':
 | 
					        if p.startswith('/') and not p.endswith('/') or p.endswith('/') or p == '':
 | 
				
			||||||
            return p
 | 
					            return p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return self._reduce_path(os.path.dirname(p))
 | 
					        return self._reduce_path(os.path.dirname(p))
 | 
				
			||||||
@@ -80,6 +80,9 @@ class LogCommand(DiscordCommandABC):
 | 
				
			|||||||
                continue
 | 
					                continue
 | 
				
			||||||
            possible_log_paths.append(path)
 | 
					            possible_log_paths.append(path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        files_str = "\n\t".join(possible_log_paths.to_list())
 | 
				
			||||||
 | 
					        self._logger.debug(__name__, f'Possible log files: \n\t{files_str}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        files = List(str)
 | 
					        files = List(str)
 | 
				
			||||||
        for possible_path in possible_log_paths:
 | 
					        for possible_path in possible_log_paths:
 | 
				
			||||||
            for r, d, f in os.walk(possible_path):
 | 
					            for r, d, f in os.walk(possible_path):
 | 
				
			||||||
@@ -93,6 +96,9 @@ class LogCommand(DiscordCommandABC):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    files.append(os.path.join(r, file))
 | 
					                    files.append(os.path.join(r, file))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        files_str = "\n\t".join(files.to_list())
 | 
				
			||||||
 | 
					        self._logger.debug(__name__, f'Log files: \n\t{files_str}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        zip_file = ZipFile('logs.zip', 'w')
 | 
					        zip_file = ZipFile('logs.zip', 'w')
 | 
				
			||||||
        files.for_each(lambda x: zip_file.write(x))
 | 
					        files.for_each(lambda x: zip_file.write(x))
 | 
				
			||||||
        zip_file.close()
 | 
					        zip_file.close()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user