aboutsummaryrefslogtreecommitdiffstats
path: root/arthur
diff options
context:
space:
mode:
Diffstat (limited to 'arthur')
-rw-r--r--arthur/bot.py2
-rw-r--r--arthur/config.py1
-rw-r--r--arthur/exts/fun/devops_rules.py9
3 files changed, 10 insertions, 2 deletions
diff --git a/arthur/bot.py b/arthur/bot.py
index b39ae60..32b0240 100644
--- a/arthur/bot.py
+++ b/arthur/bot.py
@@ -35,7 +35,7 @@ class KingArthur(BotBase):
return CONFIG.devops_role in [r.id for r in ctx.user.roles]
return False
- if ctx.command.name == "ed":
+ if ctx.command.name in {"ed", "rules"}:
return True
if not ctx.guild:
diff --git a/arthur/config.py b/arthur/config.py
index 0edf30e..7603cf9 100644
--- a/arthur/config.py
+++ b/arthur/config.py
@@ -25,6 +25,7 @@ class Config(
github_org: str = "python-discord"
devops_role: int = 409416496733880320
+ helpers_role: int = 267630620367257601
guild_id: int = 267624335836053506
devops_channel_id: int = 675756741417369640
devops_vc_id: int = 881573757536329758
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: