diff options
author | 2025-05-03 22:49:04 +0100 | |
---|---|---|
committer | 2025-05-03 22:49:04 +0100 | |
commit | 5cccfa4844f92e7b54df344d23f527b434cf1090 (patch) | |
tree | e69bc443d4e30177ba1692b6b74ea179c47a60dd /arthur/exts/fun/devops_rules.py | |
parent | Only attempt to get secret value if grafana token is not none (diff) |
Allow helpers to access rule 4
Diffstat (limited to 'arthur/exts/fun/devops_rules.py')
-rw-r--r-- | arthur/exts/fun/devops_rules.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arthur/exts/fun/devops_rules.py b/arthur/exts/fun/devops_rules.py index 418c51c..eeb5443 100644 --- a/arthur/exts/fun/devops_rules.py +++ b/arthur/exts/fun/devops_rules.py @@ -1,9 +1,10 @@ """The rules all devops members must follow.""" import discord -from discord.ext.commands import Cog, Context, Greedy, group +from discord.ext.commands import Cog, Context, Greedy, MissingRole, group from arthur.bot import KingArthur +from arthur.config import CONFIG RULES_URL = ( "https://raw.githubusercontent.com/python-discord/infra/main/docs/docs/onboarding/rules.md" @@ -34,6 +35,12 @@ class Rules(Cog): @group(name="rules", aliases=("rule",), invoke_without_command=True) async def rules_group(self, ctx: Context, rules: Greedy[int]) -> None: """List the requested rule(s), or all of them if not defined.""" + role_ids = {r.id for r in ctx.author.roles} + if CONFIG.helpers_role not in role_ids: + raise MissingRole(CONFIG.helpers_role) + if CONFIG.devops_role not in role_ids: + rules = [4] + if rules: output_rules = set(rules) & set(self.rules.keys()) else: |