aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/exts/fun/devops_rules.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2025-05-03 22:49:04 +0100
committerGravatar Chris Lovering <[email protected]>2025-05-03 22:49:04 +0100
commit5cccfa4844f92e7b54df344d23f527b434cf1090 (patch)
treee69bc443d4e30177ba1692b6b74ea179c47a60dd /arthur/exts/fun/devops_rules.py
parentOnly 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.py9
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: