[Core] Save package status and restore it on boot

Also better error handling on package loading
This commit is contained in:
Twentysix
2017-04-27 16:26:21 +02:00
parent 1d3b541e8f
commit 294adf270f
6 changed files with 85 additions and 40 deletions

View File

@@ -65,6 +65,13 @@ class Red(commands.Bot):
"""Lists packages present in the cogs the folder"""
return os.listdir("cogs")
def save_packages_status(self):
loaded = []
for package in self.extensions:
if package.startswith("cogs."):
loaded.append(package)
self.db.set_global("packages", loaded)
class ExitCodes(Enum):
CRITICAL = 1