[Core] Co-owners cli flag only, implemented owner cli flag

After giving it further thought, I don't believe co-owners really need to be a command, as it is unlikely that co-owners will need to be changed often enough.
Furthermore, this gives a further layer of protection to people who like to gloss over warnings.
This commit is contained in:
Twentysix
2017-07-25 01:46:55 +02:00
parent 2fa5792f69
commit be5c7f4592
3 changed files with 20 additions and 44 deletions

View File

@@ -10,13 +10,13 @@ class Red(commands.Bot):
def __init__(self, cli_flags, **kwargs):
self._shutdown_mode = ExitCodes.CRITICAL
self.db = Config.get_core_conf(force_registration=True)
self._co_owners = cli_flags.co_owner
self.db.register_global(
token=None,
prefix=[],
packages=[],
owner=None,
coowners=[],
whitelist=[],
blacklist=[],
enable_sentry=None
@@ -43,6 +43,9 @@ class Red(commands.Bot):
if "command_prefix" not in kwargs:
kwargs["command_prefix"] = prefix_manager
if cli_flags.owner and "owner_id" not in kwargs:
kwargs["owner_id"] = cli_flags.owner
if "owner_id" not in kwargs:
kwargs["owner_id"] = self.db.get("owner")
@@ -51,7 +54,7 @@ class Red(commands.Bot):
super().__init__(**kwargs)
async def is_owner(self, user):
if user.id in self.db.coowners():
if user.id in self._co_owners:
return True
return await super().is_owner(user)