From 39a0f257744d064ea45013ad9044a0789dbcace9 Mon Sep 17 00:00:00 2001 From: Twentysix Date: Sun, 1 Oct 2017 22:53:27 +0200 Subject: [PATCH] [Core] Implemented co-owners support (#953) --- cogs/utils/checks.py | 3 ++- cogs/utils/settings.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cogs/utils/checks.py b/cogs/utils/checks.py index bdc610443..7a7e50756 100644 --- a/cogs/utils/checks.py +++ b/cogs/utils/checks.py @@ -10,7 +10,8 @@ from __main__ import settings # def is_owner_check(ctx): - return ctx.message.author.id == settings.owner + _id = ctx.message.author.id + return _id == settings.owner or _id in ctx.bot.settings.co_owners def is_owner(): return commands.check(is_owner_check) diff --git a/cogs/utils/settings.py b/cogs/utils/settings.py index f8b41b75f..f6b9921c2 100644 --- a/cogs/utils/settings.py +++ b/cogs/utils/settings.py @@ -52,6 +52,13 @@ class Settings: parser.add_argument("--owner", help="ID of the owner. Only who hosts " "Red should be owner, this has " "security implications") + parser.add_argument("--co-owner", action="append", default=[], + help="ID of a co-owner. Only people who have " + "access to the system that is hosting Red " + "should be co-owners, as this gives them " + "complete access to the system's data. " + "This has serious security implications if " + "misused. Can be multiple.") parser.add_argument("--prefix", "-p", action="append", help="Global prefix. Can be multiple") parser.add_argument("--admin-role", help="Role seen as admin role by " @@ -98,6 +105,7 @@ class Settings: self._no_cogs = args.no_cogs self.debug = args.debug self._dry_run = args.dry_run + self.co_owners = args.co_owner self.save_settings()