[Core] Added --no-cogs

Skips initial cog loading
This commit is contained in:
Twentysix 2016-12-12 13:21:08 +01:00
parent 1c70185a53
commit 64ab3ac948
2 changed files with 12 additions and 3 deletions

View File

@ -23,7 +23,6 @@ class Settings:
"MOD_ROLE": "Process", "MOD_ROLE": "Process",
"PREFIXES": []} "PREFIXES": []}
} }
self.memory_only = False
if not dataIO.is_valid_json(self.path): if not dataIO.is_valid_json(self.path):
self.bot_settings = deepcopy(self.default_settings) self.bot_settings = deepcopy(self.default_settings)
@ -62,6 +61,9 @@ class Settings:
help="Disables console inputs. Features requiring " help="Disables console inputs. Features requiring "
"console interaction could be disabled as a " "console interaction could be disabled as a "
"result") "result")
parser.add_argument("--no-cogs",
action="store_true",
help="Starts Red with no cogs loaded, only core")
parser.add_argument("--self-bot", parser.add_argument("--self-bot",
action='store_true', action='store_true',
help="Specifies if Red should log in as selfbot") help="Specifies if Red should log in as selfbot")
@ -86,7 +88,8 @@ class Settings:
self.no_prompt = args.no_prompt self.no_prompt = args.no_prompt
self.self_bot = args.self_bot self.self_bot = args.self_bot
self.memory_only = args.memory_only self._memory_only = args.memory_only
self._no_cogs = args.no_cogs
self.debug = args.debug self.debug = args.debug
self.save_settings() self.save_settings()
@ -99,7 +102,7 @@ class Settings:
os.makedirs(folder) os.makedirs(folder)
def save_settings(self): def save_settings(self):
if not self.memory_only: if not self._memory_only:
dataIO.save_json(self.path, self.bot_settings) dataIO.save_json(self.path, self.bot_settings)
def update_old_settings_v1(self): def update_old_settings_v1(self):

6
red.py
View File

@ -488,6 +488,12 @@ def load_cogs():
"which Red cannot function. Reinstall.") "which Red cannot function. Reinstall.")
exit(1) exit(1)
if settings._no_cogs:
logger.debug("Skipping initial cogs loading (--no-cogs)")
if not os.path.isfile("data/red/cogs.json"):
dataIO.save_json("data/red/cogs.json", {})
return
failed = [] failed = []
extensions = owner_cog._list_cogs() extensions = owner_cog._list_cogs()